public static String humanReadableByteSize(long size) {
        String measure = "B";
        if (size < 1024) {
            return size + " " + measure;
        }
        double number = size;
        if (number >= 1024) {
            number = number / 1024;
            measure = "KiB";
            if (number >= 1024) {
                number = number / 1024;
                measure = "MiB";
                if (number >= 1024) {
                    number = number / 1024;
                    measure = "GiB";
                    if (number >= 1024) {
                        number = number / 1024;
                        measure = "TiB";
                    }
                }
            }
        }
        DecimalFormat format = new DecimalFormat("#0.00");
        return format.format(number) + " " + measure;
    }
@Test
    @Issue("JENKINS-16630")
    public void testHumanReadableFileSize() {
        Locale defaultLocale = Locale.getDefault();
        try {
            Locale.setDefault(Locale.ENGLISH);
            assertEquals("0 B", Functions.humanReadableByteSize(0));
            assertEquals("1023 B", Functions.humanReadableByteSize(1023));
            assertEquals("1.00 KiB", Functions.humanReadableByteSize(1024));
            assertEquals("1.50 KiB", Functions.humanReadableByteSize(1536));
            assertEquals("20.00 KiB", Functions.humanReadableByteSize(20480));
            assertEquals("1023.00 KiB", Functions.humanReadableByteSize(1047552));
            assertEquals("1.00 MiB", Functions.humanReadableByteSize(1048576));
            assertEquals("1.50 GiB", Functions.humanReadableByteSize(1610612700));
            assertEquals("1.50 TiB", Functions.humanReadableByteSize(1649267441664L));
        } finally {
            Locale.setDefault(defaultLocale);
        }
    }