public void dump() {
    int i = 0;
    while (i<hp) {
      int len = heap[i];
      System.out.print("Object at address " + (i - size)
                       + ", length=" + len
                       + ", data=[");
      for (int j=1; j<=len; j++) {
        System.out.print(Integer.toString(heap[i+j]));
        if (j<len) {
          System.out.print(", ");
        }
      }
      System.out.println("]");
      i += (len + 1);
    }
    System.out.println("Heap allocation pointer: " + hp);
  }