class BytesFormatter {

  public static String getStringDescriptionFor(long nBytes) {

    char[] units = { 'B', 'K', 'M', 'G', 'T', 'P' };

    double current = nBytes;
    double prev = current;
    int index = 0;

    while ((current = current / 1024) >= 1) {
      prev = current;
      ++index;
    }

    assert index < units.length : "Too large a number.";

    return getFormatter().format(prev) + units[index];
  }

  private  BytesFormatter();

}