I am trying to create a list using the code below, that stores random binary strings. But everytime I print the string elements of list, all the string elements that are printed are the same. ex- 101 101 101 101. How do I make it work?
ArrayList<String[]> coded = new ArrayList<String[]>();
Random rand = new Random();
for(int j=0; j<4;j++){
for (int i=0; i<3;i++){
rand1 = (rand.nextInt(4)+0)%2;
x1[i]= "" + rand1;
}
coded.add(x1);
}
x1? Do you have more than one array to add?