public static String byteCountToDisplaySize(long size) {
        if (size < 1024L) {
            return String.valueOf(size) + (size > 1 ? " bytes" : " byte");
        }
        long exp = (long) (Math.log(size) / Math.log((long) 1024));
        double value = size / Math.pow((long) 1024, exp);
        char unit = "KMGTPEZY".charAt((int) exp - 1);
        return String.format("%.1f %s%s", value, unit, "B");
    }
@Test
    public void shouldConvertBytesToMega() {
        assertThat(FileSizeUtils.byteCountToDisplaySize(1024 * 1024), is("1.0 MB"));
    }