I have an array which is declared based on another array size and initially all the values are set to 0, although assigned dynamically the size is fixed(equal to other array size), as required in Java. next I have a for
loop with certain if-else
conditions. if a condition is true
then add 1 to array first index similarly if next iteration is true
then add 1 to second index and goes on.
I want later the array to be Binary AND so if i get 1 it means all conditions are true
, if it's 0 zero it means that some where the condition was false
.
I am not in favor of using ArrayList
, also I am not sure if i can bound the length of ArrayList
, as when i do and print it it shows the size as 0.
How can I dynamically add items to a Java array?
States what is my requirment but without using the Arraylist
or List
etc, as most of the answeres i found relevant are suggesting to use ArrayList.
Thanks