Here you can find the source of convertToLong(BigInteger bigInteger)
public static long convertToLong(BigInteger bigInteger)
//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(); } } }