public static String humanReadableByteCountSI(long bytes) {
    if (-1000 < bytes && bytes < 1000) {
      if (bytes == 1) {
        return bytes + " byte";
      }
      return bytes + " bytes";
    }
    CharacterIterator ci = new StringCharacterIterator("kMGTPE");
    while (bytes <= -999_950 || bytes >= 999_950) {
      bytes /= 1000;
      ci.next();
    }
    return String.format(Locale.ENGLISH, "%.1f %cB", bytes / 1000.0, ci.current());
  }
@Test
  public void humanReadableByteCountSI_returns_kbs() {
    assertThat(FileUtils.humanReadableByteCountSI(1_234)).isEqualTo("1.2 kB");
    assertThat(FileUtils.humanReadableByteCountSI(1_000)).isEqualTo("1.0 kB");
    assertThat(FileUtils.humanReadableByteCountSI(9_999)).isEqualTo("10.0 kB");
    assertThat(FileUtils.humanReadableByteCountSI(999_949)).isEqualTo("999.9 kB");
  }