Program: 112093
Project: 112093
Buggy source:
@Test public void testPackUnPackAgainstHandWritten() throws IOException {
  System.out.println();
  System.out.println("String_Node_Str");
  for (int i=1; i < 8; i++) {
    System.out.println("String_Node_Str" + i);
    int[] values=new int[32];
    int[] packed=new int[i];
    int[] unpacked=new int[32];
    for (int j=0; j < values.length; j++) {
      values[j]=(int)(Math.random() * 100000) % (int)Math.pow(2,i);
    }
    System.out.println("String_Node_Str" + TestBitPacking.toString(values));
    final IntPacker packer=LemireBitPackingBE.getPacker(i);
    packer.pack32Values(values,0,packed,0);
    final ByteArrayOutputStream lemireOut=new ByteArrayOutputStream();
    for (    int v : packed) {
      lemireOut.write((v >>> 24) & 0xFF);
      lemireOut.write((v >>> 16) & 0xFF);
      lemireOut.write((v >>> 8) & 0xFF);
      lemireOut.write((v >>> 0) & 0xFF);
    }
    final byte[] packedByLemireAsBytes=lemireOut.toByteArray();
    System.out.println("String_Node_Str" + TestBitPacking.toString(packedByLemireAsBytes));
    final ByteArrayOutputStream manualOut=new ByteArrayOutputStream();
    final BitPackingWriter writer=BitPacking.getBitPackingWriter(i,manualOut);
    for (int j=0; j < values.length; j++) {
      writer.write(values[j]);
    }
    final byte[] packedManualAsBytes=manualOut.toByteArray();
    System.out.println("String_Node_Str" + TestBitPacking.toString(packedManualAsBytes));
    final BitPackingReader reader=BitPacking.createBitPackingReader(i,new ByteArrayInputStream(packedByLemireAsBytes),32);
    for (int j=0; j < unpacked.length; j++) {
      unpacked[j]=reader.read();
    }
    System.out.println("String_Node_Str" + TestBitPacking.toString(unpacked));
    Assert.assertArrayEquals("String_Node_Str" + i,values,unpacked);
  }
}

Fixed version (ground truth):
@Test public void testPackUnPackAgainstHandWritten() throws IOException {
  System.out.println();
  System.out.println("String_Node_Str");
  for (int i=1; i < 8; i++) {
    System.out.println("String_Node_Str" + i);
    int[] packed=new int[i];
    int[] unpacked=new int[32];
    int[] values=generateValues(i);
    final IntPacker packer=LemireBitPackingBE.getPacker(i);
    packer.pack32Values(values,0,packed,0);
    final ByteArrayOutputStream lemireOut=new ByteArrayOutputStream();
    for (    int v : packed) {
      lemireOut.write((v >>> 24) & 0xFF);
      lemireOut.write((v >>> 16) & 0xFF);
      lemireOut.write((v >>> 8) & 0xFF);
      lemireOut.write((v >>> 0) & 0xFF);
    }
    final byte[] packedByLemireAsBytes=lemireOut.toByteArray();
    System.out.println("String_Node_Str" + TestBitPacking.toString(packedByLemireAsBytes));
    final ByteArrayOutputStream manualOut=new ByteArrayOutputStream();
    final BitPackingWriter writer=BitPacking.getBitPackingWriter(i,manualOut);
    for (int j=0; j < values.length; j++) {
      writer.write(values[j]);
    }
    final byte[] packedManualAsBytes=manualOut.toByteArray();
    System.out.println("String_Node_Str" + TestBitPacking.toString(packedManualAsBytes));
    final BitPackingReader reader=BitPacking.createBitPackingReader(i,new ByteArrayInputStream(packedByLemireAsBytes),32);
    for (int j=0; j < unpacked.length; j++) {
      unpacked[j]=reader.read();
    }
    System.out.println("String_Node_Str" + TestBitPacking.toString(unpacked));
    Assert.assertArrayEquals("String_Node_Str" + i,values,unpacked);
  }
}