Java Code Examples for org.apache.hadoop.hbase.util.Bytes#vintToBytes()

The following examples show how to use org.apache.hadoop.hbase.util.Bytes#vintToBytes() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: phoenix   File: ByteUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testVIntToBytes() {
    for (int i = -10000; i <= 10000; i++) {
        byte[] vint = Bytes.vintToBytes(i);
        int vintSize = vint.length;
        byte[] vint2 = new byte[vint.length];
        assertEquals(vintSize, ByteUtil.vintToBytes(vint2, 0, i));
        assertTrue(Bytes.BYTES_COMPARATOR.compare(vint,vint2) == 0);
    }
}
 
Example 2
Source Project: phoenix   File: ByteUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testVIntToBytes() {
    for (int i = -10000; i <= 10000; i++) {
        byte[] vint = Bytes.vintToBytes(i);
        int vintSize = vint.length;
        byte[] vint2 = new byte[vint.length];
        assertEquals(vintSize, ByteUtil.vintToBytes(vint2, 0, i));
        assertTrue(Bytes.BYTES_COMPARATOR.compare(vint,vint2) == 0);
    }
}
 
Example 3
@Test
public void testVIntToBytes() {
    for (int i = -10000; i <= 10000; i++) {
        byte[] vint = Bytes.vintToBytes(i);
        int vintSize = vint.length;
        byte[] vint2 = new byte[vint.length];
        assertEquals(vintSize, ByteUtil.vintToBytes(vint2, 0, i));
        assertTrue(Bytes.BYTES_COMPARATOR.compare(vint,vint2) == 0);
    }
}