public static void toHexFile(String fileName,ByteBuffer buffer,int offset,int size) throws IOException {
  PrintWriter writer=new PrintWriter(new FileWriter(fileName));
  try {
    writer.println(toHexString(buffer,offset,size));
  }
  finally {
    writer.close();
  }
}

public static void toHexFile ( String fileName , ByteBuffer buffer , int offset , int size ) throws IOException { PrintWriter writer = new PrintWriter ( new FileWriter ( fileName ) ) ; try { writer . println ( toHexString ( buffer , offset , size ) ) ; } finally { writer . close ( ) ; } }
writes a chunk of data to a file in pretty printed hexidecimal .
