Java Long Number Readable Format formatBytes(long bts)

Here you can find the source of formatBytes(long bts)

Description

format Bytes

License

Apache License

Declaration

public static String formatBytes(long bts) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String formatBytes(long bts) {
        long bt = bts % 1024;
        long kb = (bts / 1024) % 1024;
        long mb = bts / (1024 * 1024);
        return ((mb > 0) ? (mb + "MB,") : "") + ((kb > 0) ? (kb + "KB,") : "") + ((bt > 0) ? (bt + "BYTES") : "");
    }/*from  w  w w  .j a v a 2s  . co  m*/
}

Related

  1. convertByteToGMKB(long bytes)
  2. convertByteUnit(Long l)
  3. convertHumanSize(long byteSize)
  4. convertLongToMega(long value)
  5. convertMbIntoGb(long megaBytes)
  6. formatBytes(long bytes)
  7. formatBytes(long bytes)
  8. formatBytes(long bytes)
  9. formatBytes(long bytes)