Java BigInteger Format formatSize(BigInteger size)

Here you can find the source of formatSize(BigInteger size)

Description

format Size

License

Apache License

Declaration

public static String formatSize(BigInteger size) 

Method Source Code


//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";
    }
}

Related

  1. formatBigInteger(BigInteger bi, int length)
  2. formatBigIntegerBinary(final long value, byte[] buf, final int offset, final int length, final boolean negative)
  3. formatSerialNumber(BigInteger bi)
  4. formatSerialNumber(final BigInteger serial)
  5. formatTime(BigInteger femto)