@Test
public void testToHex() {

  Assert.assertThat(ByteAndBitConverter.toHex(
      new boolean[]{false, false, false, false, false, false, false, false}), Is.is("00"));
  Assert.assertThat(
      ByteAndBitConverter.toHex(new boolean[]{true, true, true, true, true, true, true, true}),
      Is.is("ff"));
  Assert.assertThat(
      ByteAndBitConverter.toHex(new boolean[]{true, true, true, true, true, true, true}),
      Is.is("7f"));
  Assert.assertThat(
      ByteAndBitConverter.toHex(new boolean[]{true, true, true, true, true, true}),
      Is.is("3f"));
  Assert.assertThat(ByteAndBitConverter.toHex(new boolean[]{true, true, true, true, true}),
      Is.is("1f"));
  Assert.assertThat(ByteAndBitConverter.toHex(new boolean[]{true, true, true, true}),
      Is.is("0f"));
  Assert.assertThat(
      ByteAndBitConverter
          .toHex(new boolean[]{false, true, true, true, true, true, true, true, true}),
      Is.is("00ff"));
  Assert.assertThat(ByteAndBitConverter.toHex(
      new boolean[]{true, true, true, true, true, true, true, true, true}), Is.is("01ff"));
  Assert.assertThat(
      ByteAndBitConverter.toHex(Arrays
          .asList((new Boolean[]{true, true, true, true, true, true, true, true, true}))),
      Is.is("01ff"));
}