guavasupport/src/main/java/com/streamsets/pipeline/lib/io/fileref/MetricEnabledWrapperStream.java
static String convertBytesToDisplayFormat(double bytes) {
    int unitIdx = 0;
    double unitChangedBytes = bytes;
    while (unitIdx < UNITS.length - 1 && Math.floor(unitChangedBytes / 1024) > 0) {
      unitChangedBytes = unitChangedBytes / 1024;
      unitIdx++;
    }
    return df.format(unitChangedBytes) + " " + UNITS[unitIdx];
  }
static String convertBytesToDisplayFormat(double bytes) {
    int unitIdx = 0;
    double unitChangedBytes = bytes;
    while (unitIdx < UNITS.length - 1 && Math.floor(unitChangedBytes / 1024) > 0) {
      unitChangedBytes = unitChangedBytes / 1024;
      unitIdx++;
    }
    return df.format(unitChangedBytes) + " " + UNITS[unitIdx];
  }
static String convertBytesToDisplayFormat ( double bytes ) { int unitIdx = 0 ; double unitChangedBytes = bytes ; while ( unitIdx < UNITS . length - 1 && Math . floor ( unitChangedBytes / 1024 ) > 0 ) { unitChangedBytes = unitChangedBytes / 1024 ; unitIdx ++ ; } return df . format ( unitChangedBytes ) + " " + UNITS [ unitIdx ] ; }
Convert the bytes to a human readable format upto 2 decimal places
The maximum unit is TB, so anything exceeding 1024 TB will be shown
with TB unit.
@param bytes the number of bytes.
@return human readable format of bytes in units.
Convert the bytes to a human readable format upto 2 decimal places The maximum unit is TB so anything exceeding 1024 TB will be shown with TB unit .