A) int a[][]=new int[20][32];
a[2][3]=1;
if(a[2][3]==1)
{
System.out.println("true");
}
B) int a[]=new int[20];
a[2]=12;
if ((a[2] & (1 << 3)) != 0)
{
System.out.println("true");
}
In A) I am using 2D int array , I am checking [2,3] is 1 or not
In B) I am using index of Int as 2nd dim. of mat.Here I am checking 3 bit of 2nd element of Array.
Which one is better? And why In context of Speed and memory?
Bis that the arrays of 32 have been replaced by ints.