RLP { public static byte[] encodeList(byte[]... elements) { int totalLength = 0; for (int i = 0; i < elements.length; ++i) { totalLength += elements[i].length; } byte[] data; int copyPos = 0; if (totalLength < SIZE_THRESHOLD) { data = new byte[1 + totalLength]; data[0] = (byte) (OFFSET_SHORT_LIST + totalLength); copyPos = 1; } else { int tmpLength = totalLength; byte byteNum = 0; while (tmpLength != 0) { ++byteNum; tmpLength = tmpLength >> 8; } tmpLength = totalLength; byte[] lenBytes = new byte[byteNum]; for (int i = 0; i < byteNum; ++i) { lenBytes[byteNum - 1 - i] = (byte) ((tmpLength >> (8 * i)) & 0xFF); } data = new byte[1 + lenBytes.length + totalLength]; data[0] = (byte) (OFFSET_LONG_LIST + byteNum); System.arraycopy(lenBytes, 0, data, 1, lenBytes.length); copyPos = lenBytes.length + 1; } for (int i = 0; i < elements.length; ++i) { System.arraycopy(elements[i], 0, data, copyPos, elements[i].length); copyPos += elements[i].length; } return data; }  static int decodeInt(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int index); static byte[] decodeIP4Bytes(byte[] data, int index); static int getFirstListElement(byte[] payload, int pos); static int getNextElementIndex(byte[] payload, int pos); static void fullTraverse(byte[] msgData, int level, int startPos,
			int endPos, int levelToIndex, Queue<Integer> index); static byte getCommandCode(byte[] data); static RLPList decode2(byte[] msgData); static DecodeResult decode(byte[] data, int pos); static byte[] encode(Object input); static byte[] encodeLength(int length, int offset); static byte[] encodeByte(byte singleByte); static byte[] encodeShort(short singleShort); static byte[] encodeInt(int singleInt); static byte[] encodeString(String srcString); static byte[] encodeBigInteger(BigInteger srcBigInteger); static byte[] encodeElement(byte[] srcData); static byte[] encodeList(byte[]... elements);  }
@Test public void test9() { byte[] actuals = RLP.encodeList(); assertArrayEquals(new byte[] { (byte) 0xc0 }, actuals); }