Is a BigInteger Even
import java.math.BigInteger;
public class Main {
public static void main(String[] argv) {
BigInteger number = new BigInteger("2008");
System.out.println(isEven(number));
}
public static boolean isEven(BigInteger number) {
return number.getLowestSetBit() != 0;
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
BigInteger:
- Create BigInteger from byte array
- Create BigInteger from string and long
- Convert BigInteger to byte array
- Convert BigInteger into binary string
- Convert BigInteger to specified radix
- Convert BigInteger to hexadecimal integer
- Convert BigInteger to integer
- Convert BigInteger to octal string
- Convert binary string to BigInteger
- Convert octal string to BigInteger
- Convert hexadecimal string to BigInteger
- Divide one BigInteger from another BigInteger
- Multiply one BigInteger to another BigInteger
- Negate a BigInteger
- Power a BigInteger
- Subtract one BigInteger from another BigInteger
- Is BigInteger Probable Prime
- Is a BigInteger Even
- Bit clear on BigInteger
- Bit flip on BigInteger
- Bit set on BigInteger
- Bit shift left on BigInteger
- Bit shift right on BigInteger
- Bit Test on BigInteger
- XOR a BigInteger from another BigInteger
- And operation on BigInteger
- Not operation on BigInteger
- Or operation on BigInteger
- andNot operation on BigInteger