### Question:
BucketFunctions { public static LongFunction<String> bytes(long max) { ValueFormatter f = getFormatter(BINARY_FORMATTERS, max); return biasZero("negative", "large", max, f); } private  BucketFunctions(); static LongFunction<String> age(long max, TimeUnit unit); static LongFunction<String> latency(long max, TimeUnit unit); static LongFunction<String> ageBiasOld(long max, TimeUnit unit); static LongFunction<String> latencyBiasSlow(long max, TimeUnit unit); static LongFunction<String> bytes(long max); static LongFunction<String> decimal(long max);  }### Answer:
@Test public void bytes1K() { LongFunction<String> f = BucketFunctions.bytes(1024); Assertions.assertEquals("negative", f.apply(-1L)); Assertions.assertEquals("0256_B", f.apply(212)); Assertions.assertEquals("0512_B", f.apply(512)); Assertions.assertEquals("1024_B", f.apply(761)); Assertions.assertEquals("large", f.apply(20001)); }
@Test public void bytes20K() { LongFunction<String> f = BucketFunctions.bytes(20000); Assertions.assertEquals("negative", f.apply(-1L)); Assertions.assertEquals("02_KiB", f.apply(761)); Assertions.assertEquals("04_KiB", f.apply(4567)); Assertions.assertEquals("19_KiB", f.apply(15761)); Assertions.assertEquals("large", f.apply(20001)); }
@Test public void bytes2M() { LongFunction<String> f = BucketFunctions.bytes(2 * 1024 * 1024); Assertions.assertEquals("negative", f.apply(-1L)); Assertions.assertEquals("0256_KiB", f.apply(761)); Assertions.assertEquals("0512_KiB", f.apply(400_000)); Assertions.assertEquals("1024_KiB", f.apply(512 * 1024 + 1)); Assertions.assertEquals("large", f.apply(2 * 1024 * 1024 + 1)); }
@Test public void bytesMaxValue() { LongFunction<String> f = BucketFunctions.bytes(Long.MAX_VALUE); Assertions.assertEquals("negative", f.apply(-1L)); Assertions.assertEquals("1023_PiB", f.apply(761)); Assertions.assertEquals("2047_PiB", f.apply(Long.MAX_VALUE / 4)); Assertions.assertEquals("4095_PiB", f.apply(Long.MAX_VALUE / 2)); Assertions.assertEquals("8191_PiB", f.apply(Long.MAX_VALUE)); }