Java BigInteger Value Check isOdd(BigInteger in)

Here you can find the source of isOdd(BigInteger in)

Description

Tests whether a given BigInteger is odd.

License

BSD License

Parameter

Parameter Description
in The BigInteger to test

Return

true if odd, false otherwise

Declaration

public static final boolean isOdd(BigInteger in) 

Method Source Code


//package com.java2s;
/*/*from  w  w  w  . j ava2  s.  c  om*/
 * This file is part of an unofficial ISO20008-2.2 sample implementation to
 * evaluate certain schemes for their applicability on Android-based mobile
 * devices. The source is licensed under the modified 3-clause BSD license,
 * see the readme.
 * 
 * The code was published in conjunction with the publication called 
 * "Group Signatures on Mobile Devices: Practical Experiences" by
 * Potzmader, Winter, Hein, Hanser, Teufl and Chen
 */

import java.math.BigInteger;

public class Main {
    /**
     * Tests whether a given {@link BigInteger} is odd. Convience-wrapper
     * for {@link BigInteger#testBit(int)}.
     * 
     * @param in The {@link BigInteger} to test
     * @return true if odd, false otherwise
     */
    public static final boolean isOdd(BigInteger in) {
        return in.testBit(0);
    }
}

Related

  1. isLessThan(BigInteger valueA, BigInteger valueB)
  2. isLong(BigInteger number)
  3. isMersenneNumber(BigInteger n)
  4. isNegative(BigInteger i)
  5. isNumberInRange(String text, BigInteger min, BigInteger max)
  6. isOdd(BigInteger x)
  7. isPerfectCubic(BigInteger n)
  8. isPositive(final BigInteger value)
  9. isPowerOfTwo(BigInteger bintValue)