Java BigInteger Parse getBinaryNumberInString(BigInteger integerNumber)

Here you can find the source of getBinaryNumberInString(BigInteger integerNumber)

Description

This method gets the binary representation of any integer number.
The binary representation is returned in String format

License

Open Source License

Parameter

Parameter Description
integerNumber A integer number

Return

The binary number in string format

Declaration

public static String getBinaryNumberInString(BigInteger integerNumber) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigInteger;

public class Main {
    /**/*from  w  w w . j  av a 2 s. com*/
     * A constant to represent the base/radix 2
     */
    private final static int BINARY_RADIX = 2;

    /**
     * This method gets the binary representation of any integer number.<br/>
     * The binary representation is returned in String format
     * @param integerNumber A integer number between {@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
     * @return The binary number in string format
     */
    public static String getBinaryNumberInString(Integer integerNumber) {
        return Integer.toBinaryString(integerNumber);
    }

    /**
     * This method gets the binary representation of any integer number.<br/>
     * The binary representation is returned in String format
     * @param integerNumber A integer number
     * @return The binary number in string format
     */
    public static String getBinaryNumberInString(BigInteger integerNumber) {
        return integerNumber.toString(BINARY_RADIX);
    }
}

Related

  1. getBigInteger(Number number)
  2. getBigInteger(Number value)
  3. getBigInteger(String value)
  4. getBigIntegerArrayFromByteArray(byte[] buf)
  5. getBigIntegerValue(final Integer value)
  6. toBigInteger(String bigInteger)
  7. toBigInteger(String s)
  8. ToBigInteger(String s)
  9. toBigInteger(String text)