public static ByteRange parse(final String byteRange,
                                  final int resourceLength) {
        final String asciiString = new String(byteRange.getBytes(), StandardCharsets.US_ASCII);
        // missing separator
        if (!byteRange.contains("-")) {
            final int start = Integer.parseInt(asciiString);
            return new ByteRange(start, resourceLength - 1);
        }
        // negative range
        if (byteRange.indexOf("-") == 0) {
            final int start = Integer.parseInt(asciiString);
            return new ByteRange(resourceLength + start, resourceLength - 1);
        }
        final List<String> parts = Arrays.stream(asciiString.split("-", -1))
                .map(String::trim)
                .filter(s -> !s.isEmpty())
                .collect(Collectors.toList());

        final int start = Integer.parseInt(parts.get(0));
        if (parts.size() == 2) {
            int end = Integer.parseInt(parts.get(1));
            if (end > resourceLength) {
                end = resourceLength - 1;
            }
            return new ByteRange(start, end);
        } else {
            return new ByteRange(start, resourceLength - 1);
        }
    }
@Test
    void nonASCIIDisallowed() {
        assertThatExceptionOfType(NumberFormatException.class)
            .isThrownBy(() -> ByteRange.parse("០-០", RESOURCE_LENGTH));
    }