is Odd BigInteger - Java java.math

Java examples for java.math:BigInteger

Description

is Odd BigInteger

Demo Code


import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Arraycopy;
import java.util.Random;
import static java.math.BigInteger.ONE;
import static java.math.BigInteger.ZERO;

public class Main{
    public static void main(String[] argv) throws Exception{
        BigInteger bigInteger = new BigInteger("1234");
        System.out.println(isOdd(bigInteger));
    }/*w w  w.ja  v  a 2  s .  co m*/
    public static boolean isOdd(BigInteger bigInteger) {
        return bigInteger.testBit(0);
    }
}

Related Tutorials