Java Code Examples for com.helger.commons.CGlobal#BYTES_PER_PETABYTE

The following examples show how to use com.helger.commons.CGlobal#BYTES_PER_PETABYTE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SizeHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
public String getAsMatching (final long nSize)
{
  if (nSize >= CGlobal.BYTES_PER_PETABYTE)
    return getAsPB (nSize);
  if (nSize >= CGlobal.BYTES_PER_TERABYTE)
    return getAsTB (nSize);
  if (nSize >= CGlobal.BYTES_PER_GIGABYTE)
    return getAsGB (nSize);
  if (nSize >= CGlobal.BYTES_PER_MEGABYTE)
    return getAsMB (nSize);
  if (nSize >= CGlobal.BYTES_PER_KILOBYTE)
    return getAsKB (nSize);
  return _format (nSize) + B_SUFFIX;
}
 
Example 2
Source File: SizeHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
public String getAsMatching (final long nSize, @Nonnegative final int nDecimals)
{
  if (nSize >= CGlobal.BYTES_PER_PETABYTE)
    return getAsPB (nSize, nDecimals);
  if (nSize >= CGlobal.BYTES_PER_TERABYTE)
    return getAsTB (nSize, nDecimals);
  if (nSize >= CGlobal.BYTES_PER_GIGABYTE)
    return getAsGB (nSize, nDecimals);
  if (nSize >= CGlobal.BYTES_PER_MEGABYTE)
    return getAsMB (nSize, nDecimals);
  if (nSize >= CGlobal.BYTES_PER_KILOBYTE)
    return getAsKB (nSize, nDecimals);
  return _format (nSize, nDecimals) + B_SUFFIX;
}