OSSerializer { public static byte[] leftPaddingZeroes(byte[] paddMe, int zeros) { byte[] tmp = new byte[zeros + paddMe.length]; System.arraycopy(paddMe, 0, tmp, zeros, paddMe.length); return tmp; }  static byte[] serializeConfidentialData(OptionSet options, byte[] payload, int realCode); static byte[] serializeAAD(int version, AlgorithmID algorithm, int requestSeq, byte[] requestSenderId, OptionSet options); static byte[] nonceGeneration(byte[] partialIV, byte[] senderID, byte[] commonIV, int nonceLength); static byte[] leftPaddingZeroes(byte[] paddMe, int zeros); static byte[] processPartialIV(int value); static byte[] stripZeroes(byte[] in);  }
@Test public void testLeftPadding() { byte[] paddMe = new byte[] { 0x01, 0x02 }; byte[] expected = new byte[] { 0x00, 0x00, 0x01, 0x02 }; int zeros = 2; byte[] updated = OSSerializer.leftPaddingZeroes(paddMe, zeros); assertTrue(Arrays.equals(expected, updated)); }