本文整理匯總了Java中org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java ArrayUtils.EMPTY_BYTE_ARRAY屬性的具體用法?Java ArrayUtils.EMPTY_BYTE_ARRAY怎麽用?Java ArrayUtils.EMPTY_BYTE_ARRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.lang.ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils.EMPTY_BYTE_ARRAY屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: unitTestUniformSplit
/**
* Unit tests for the UniformSplit algorithm. Makes sure it divides up the space of
* keys in the way that we expect.
*/
@Test
public void unitTestUniformSplit() {
UniformSplit splitter = new UniformSplit();
// Check splitting while starting from scratch
try {
splitter.split(1);
throw new AssertionError("Splitting into <2 regions should have thrown exception");
} catch (IllegalArgumentException e) { }
byte[][] twoRegionsSplits = splitter.split(2);
assertEquals(1, twoRegionsSplits.length);
assertArrayEquals(twoRegionsSplits[0],
new byte[] { (byte) 0x80, 0, 0, 0, 0, 0, 0, 0 });
byte[][] threeRegionsSplits = splitter.split(3);
assertEquals(2, threeRegionsSplits.length);
byte[] expectedSplit0 = new byte[] {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
assertArrayEquals(expectedSplit0, threeRegionsSplits[0]);
byte[] expectedSplit1 = new byte[] {(byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA,
(byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA};
assertArrayEquals(expectedSplit1, threeRegionsSplits[1]);
// Check splitting existing regions that have start and end points
byte[] splitPoint = splitter.split(new byte[] {0x10}, new byte[] {0x30});
assertArrayEquals(new byte[] {0x20}, splitPoint);
byte[] lastRow = new byte[] {xFF, xFF, xFF, xFF, xFF, xFF, xFF, xFF};
assertArrayEquals(lastRow, splitter.lastRow());
byte[] firstRow = ArrayUtils.EMPTY_BYTE_ARRAY;
assertArrayEquals(firstRow, splitter.firstRow());
splitPoint = splitter.split(firstRow, new byte[] {0x20});
assertArrayEquals(splitPoint, new byte[] {0x10});
splitPoint = splitter.split(new byte[] {(byte)0xdf, xFF, xFF, xFF, xFF,
xFF, xFF, xFF}, lastRow);
assertArrayEquals(splitPoint,
new byte[] {(byte)0xef, xFF, xFF, xFF, xFF, xFF, xFF, xFF});
splitPoint = splitter.split(new byte[] {'a', 'a', 'a'}, new byte[] {'a', 'a', 'b'});
assertArrayEquals(splitPoint, new byte[] {'a', 'a', 'a', (byte)0x80 });
}