public static long size2Long(String size) {
        if (null == size || size.length() <= 1) {
            throw new IllegalArgumentException("could not convert '" + size + "' to byte length");
        }

        String size2Lower = size.toLowerCase();
        char unit = size2Lower.charAt(size.length() - 1);
        long number;
        try {
            number = NumberUtils.toLong(size2Lower.substring(0, size.length() - 1));
        } catch (NumberFormatException | NullPointerException ex) {
            throw new IllegalArgumentException("could not convert '" + size + "' to byte length");
        }

        switch (unit) {
            case 'k':
                return number * RADIX;
            case 'm':
                return number * RADIX * RADIX;
            case 'g':
                return number * RADIX * RADIX * RADIX;
            case 't':
                return number * RADIX * RADIX * RADIX * RADIX;
            default:
                throw new IllegalArgumentException("could not convert '" + size + "' to byte length");
        }
    }
@Test
    void size2Long() {
        assertThatThrownBy(() -> SizeUtil.size2Long(null)).isInstanceOf(IllegalArgumentException.class);
        assertThatThrownBy(() -> SizeUtil.size2Long("")).isInstanceOf(IllegalArgumentException.class);
        // wrong format
        assertThatThrownBy(() -> SizeUtil.size2Long("2kk")).isInstanceOf(IllegalArgumentException.class);
        // wrong unit
        assertThatThrownBy(() -> SizeUtil.size2Long("2x")).isInstanceOf(IllegalArgumentException.class);

        assertThat(SizeUtil.size2Long("2k")).isEqualTo(2L * 1024);
        assertThat(SizeUtil.size2Long("2m")).isEqualTo(2L * 1024 * 1024);
        assertThat(SizeUtil.size2Long("2G")).isEqualTo(2L * 1024 * 1024 * 1024);
        assertThat(SizeUtil.size2Long("2t")).isEqualTo(2L * 1024 * 1024 * 1024 * 1024);
    }