Java BigInteger to convertToLong(BigInteger bigInteger)

Here you can find the source of convertToLong(BigInteger bigInteger)

Description

convert To Long

License

Open Source License

Declaration

public static long convertToLong(BigInteger bigInteger) 

Method Source Code


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

import java.math.BigInteger;

public class Main {
    public static long convertToLong(BigInteger bigInteger) {
        if (bigInteger.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) == 1) {
            return Long.MAX_VALUE;
        } else {//from w  w w.  j  av  a 2s.  c o  m
            return bigInteger.longValue();
        }
    }
}

Related

  1. convertBigIntegerToNBytes( final BigInteger bigInteger, final int numBytes)
  2. convertPositive(BigInteger bi)
  3. convertRealNumberBits(BigInteger source, int size, int direction)
  4. convertRepresentation(BigInteger b)
  5. convertToBase62String(BigInteger value)
  6. convertToString(BigInteger biSequence, int kmerSize)
  7. convertValueToZeroIfNullOrNegative(BigInteger value)
  8. getUnsignedBigIntegerAsHex(BigInteger bi)
  9. getUnsignedBytes(BigInteger number, int length)