I need to populate a 2d array with odd numbers.
I want it to look like this
13579
13579
13579
13579
This is what I have so far:
public static void twoDArray(){
//http://stackoverflow.com/questions/11243774/how-to-automatically-populate-a-2d-array-with-numbers
int twoDimention[][] = new int[5][3];
for(int i=0; i<twoDimention.length; i++){
for(int j=0; j<twoDimention[i].length; j++){
twoDimention[i][j] = 2*i + 1;
System.out.printf("%d5", twoDimention[i][j]);
}
System.out.println();
}
It prints:
1515151515
3535353535
5555555555
7575757575
9595959595
Can someone help make this work?