@Test
void testToInt() {

    ByteBuffer[] buf = {
            BufferUtils.toBuffer("0"),
            BufferUtils.toBuffer(" 42 "),
            BufferUtils.toBuffer("   43abc"),
            BufferUtils.toBuffer("-44"),
            BufferUtils.toBuffer(" - 45;"),
            BufferUtils.toBuffer("-2147483648"),
            BufferUtils.toBuffer("2147483647"),
    };
    int[] val = {
            0, 42, 43, -44, -45, -2147483648, 2147483647
    };
    for (int i = 0; i < buf.length; i++)
        assertEquals(val[i], BufferUtils.toInt(buf[i]), "t" + i);
}