ByteUtil { public static boolean isInteger(final byte[] asciiBuffer, final int offset, final int length) { for (int i = 0; i < length; i++) { if (!isAsciiDigit(asciiBuffer[offset + i])) { return false; } } return true; }  static void writeLongAsAscii(final byte[] outputBuffer, final int offset, final long valueParam); static boolean isAsciiDigit(final byte asciiCharacter); static String formatIntAsIpAddress(final int address); static void formatIntAsIpAddress(final StringBuilder buffer, final int address); static long packLongWithUnsignedShortInts(final int int1, final int int2, final int int3, final int int4); static boolean isEqual(final byte[] lhs, final int lhsOffset, final byte[] rhs, final int rhsOffset, final int length); static int readIntFromAscii(final byte[] asciiBuffer, final int offset, final int length); static long readLongFromAscii(final byte[] asciiBuffer, final int offset, final int length); static boolean isInteger(final byte[] asciiBuffer, final int offset, final int length); static void replace(final byte[] buffer, final int offset, final int length,
                               final byte target, final byte replacement); static void asciiEncode(final CharSequence chars, final int charOffset,
                                   final byte[] buffer, final int bufferOffset, final int length); static final int MAX_UNSIGNED_SHORT; }
@Test public void shouldConfirmIsIntegerValue() throws UnsupportedEncodingException { final byte[] bytes = "123".getBytes(StandardCharsets.US_ASCII); assertTrue(ByteUtil.isInteger(bytes, 0, bytes.length)); }
@Test public void shouldConfirmIsNotIntegerValue() throws UnsupportedEncodingException { final byte[] bytes = "1;3".getBytes(StandardCharsets.US_ASCII); assertFalse(ByteUtil.isInteger(bytes, 0, bytes.length)); }