public static void dump(DataInputStream ios, int length) {
      try {
         String s;
         String a = "";
         for (int i = 0, j = 0; i < length; i++) {
            int val = ios.read();
            if (val < 0) System.exit(0);
            if (j == 0) {
               System.out.println("  " + a);
               a = "";
               s = Integer.toHexString(i);
               s = s + "      ".substring(s.length());
               System.out.print(s + "  ");
            }
            if (j == 8) System.out.print("  ");
            s = Integer.toHexString(val);
            if (s.length() < 2) s = "0" + s;
            System.out.print(s + " ");
            if ((val > 32) && (val < 128)) a += (char)val; else a += ' ';
            if (++j == 16) j = 0;
         }
         System.out.println("");
      } catch(IOException e) {
         System.out.println(e);
      }
   }