code: public static String condenseFileSize(long bytes, String precision) throws IllegalFormatException {
  
          // Kilobyte Check
          float kilo = bytes / 1024f;
          float mega = kilo / 1024f;
          float giga = mega / 1024f;
          float tera = giga / 1024f;
          float peta = tera / 1024f;
  
          // Determine which value to send back
          if(peta > 1)
              return String.format(precision + " PB", peta);
          else if (tera > 1)
              return String.format(precision + " TB", tera);
          else if(giga > 1)
              return String.format(precision + " GB", giga);
          else if(mega > 1)
              return String.format(precision + " MB", mega);
          else if(kilo > 1)
              return String.format(precision + " KB", kilo);
          else
              return bytes + " b";
  
      }
docs: Condense a file size in bytes to it's highest form (i.e. KB, MB, GB, etc)
  
  @param bytes		    the size in bytes
  @param precision     the precision constant {@code ONE_DIGIT}, {@code TWO_DIGIT}, {@code THREE_DIGIT}
  @return			the condensed string