@Test
public void testGetLastNBytes() {

    assertThat(getLastNBytes(new byte[]{0x01, 0x02, 0x03}, 2), is(new byte[]{0x02, 0x03}));
    assertThat(getLastNBytes(new byte[]{0x01, 0x02, 0x03}, 3), is(new byte[]{0x01, 0x02, 0x03}));
    assertThat(getLastNBytes(new byte[]{0x01, 0x02, 0x03}, 0), is(new byte[]{}));
    assertThat(getLastNBytes(new byte[]{}, 2), is(new byte[]{}));
    assertThat(getLastNBytes(null, 2), is(new byte[]{}));
}