booleans
Author |
Message |
kevin Noronha
|
Posted: 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);
}
}
}
} |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Clayton

|
Posted: 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? |
|
|
|
|
 |
A.J

|
Posted: Sat Mar 08, 2008 9:04 pm Post subject: Re: booleans |
|
|
to check if x is an integer, round(x) must equal to x. |
|
|
|
|
 |
HeavenAgain

|
Posted: 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. |
|
|
|
|
 |
|
|