Here you can find the source of formatSize(BigInteger size)
public static String formatSize(BigInteger size)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; public class Main { final private static BigInteger ONE_THOUSAND = new BigInteger("1024"); public static String formatSize(BigInteger size) { if (size.compareTo(ONE_THOUSAND) == 1) { return size.divide(ONE_THOUSAND).toString() + " TB"; } else/*w ww . jav a 2 s. c o m*/ return size.toString() + " GB"; } }