luxx
03-25-2009, 01:03 PM
I have a table in java in which all the values are held in boolean but I wanted to make the true and falses 1 and 0's. How could I do this since boolean and int are incompatible types?
![]() | View Full Version : Java table luxx 03-25-2009, 01:03 PM I have a table in java in which all the values are held in boolean but I wanted to make the true and falses 1 and 0's. How could I do this since boolean and int are incompatible types? hikarunogo10 03-25-2009, 07:38 PM u mean 2dimentional array u have? ArcticRaiders 03-25-2009, 10:49 PM What do you mean a table? I could see it as an array. if so here is one way of converting between booleans to ints in the way you want it done. //have your array of boolean values //create an array of int values // I have named my arrays arr and arr2 respectively for(k=0; k < arr.length; k++){ if( arr[k] ) arr2[k] = 1; else arr2[k] = 0; } |