0

currently I am randomly generating a set of number from 0 to 7 in decimal in array..then I hav to convert them in binary form... however,i fail to get it.. any mistake i did?hope to get
some advises from u ..

public class Initializationtest {

         public static void main(String[] args){

                  int[][] popsize = new int[20][19];
                           for(int i =0 ; i <popsize.length; i++){
                                  for(int j =0 ; j <popsize[i].length; j++){
                                   popsize[i][j] = (int)(Math.random()*8);

                          System.out.print(Integer.parseInt("popsize[i][j]",2));
                                      } 
                          System.out.println();
                }

            }

}

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by parthiban
0

Hi seang85,
I don't want to do your homework but here is where going wrong .

System.out.print(Integer.parseInt("popsize[j]",2));

There is a build in function to ease your work .Try to find it .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.