public static ByteSizeUnit fromBytes(final long bytes) {
        ByteSizeUnit val = intToEnumMap.get(bytes);
        if (val == null) {
            throw new IllegalArgumentException(String.format(
                    "The byte value %s is not a valid value for conversion into a ByteSizeUnit unit", bytes));
        }
        return val;
    }
Utility class for handling byte size units such as MiB, GiB, TiB etc.
stroom-util/src/main/java/stroom/util/io/ByteSizeUnit.java