Computer Science Canada

booleans

Author:  kevin Noronha [ Sat Mar 08, 2008 8:29 pm ]
Post subject:  booleans

umm...anyone know how i can check, if when i divide 2 integers, if they are integers or not?

here is the code

import java.util.*;

class Factors{
public static HashSet primes(int high){
HashSet primeset=new HashSet();
for(int i=0;i>high;i++){
if ((i/2)!=Integer){
primeset.add(i);
}
}
}
}

Author:  Clayton [ Sat Mar 08, 2008 8:34 pm ]
Post subject:  RE:booleans

Check if the value returned is equal to the value returned casted to an int?

Author:  A.J [ Sat Mar 08, 2008 9:04 pm ]
Post subject:  Re: booleans

to check if x is an integer, round(x) must equal to x.

Author:  HeavenAgain [ Sat Mar 08, 2008 9:24 pm ]
Post subject:  RE:booleans

why not just
code:
if (i%2 == 0) // if is 0 then there is no remainder (decimal), or else is 1
Integer is a reference type, you cannot compare a int (data type); (i/2), with a reference type; Integer.


: