code: public static void printTargetInformationBlockFromType2Message(
              byte[] msg, Integer msgFlags, PrintWriter out)
              throws UnsupportedEncodingException {
          int flags = msgFlags == null ? extractFlagsFromType2Message(msg)
                  : msgFlags;
  
          byte[] infoBlock = extractTargetInfoFromType2Message(msg, flags);
          if (infoBlock == null) {
              out.println("No target information block found !");
          } else {
              int pos = 0;
              while (infoBlock[pos] != 0) {
                  out.print("---\nType " + infoBlock[pos] + ": ");
                  switch (infoBlock[pos]) {
                      case 1:
                          out.println("Server name");
                          break;
                      case 2:
                          out.println("Domain name");
                          break;
                      case 3:
                          out.println("Fully qualified DNS hostname");
                          break;
                      case 4:
                          out.println("DNS domain name");
                          break;
                      case 5:
                          out.println("Parent DNS domain name");
                          break;
                  }
                  byte[] len = new byte[2];
                  System.arraycopy(infoBlock, pos + 2, len, 0, 2);
                  ByteUtilities.changeByteEndianess(len, 0, 2);
  
                  int length = ByteUtilities.makeIntFromByte2(len, 0);
                  out.println("Length: " + length + " bytes");
                  out.print("Data: ");
                  if (ByteUtilities.isFlagSet(flags, FLAG_NEGOTIATE_UNICODE)) {
                      out.println(new String(infoBlock, pos + 4, length,
                              "UTF-16LE"));
                  } else {
                      out.println(new String(infoBlock, pos + 4, length, "ASCII"));
                  }
                  pos += 4 + length;
                  out.flush();
              }
          }
      }
docs: Prints to the {@link PrintWriter} the target information block extracted
  from the type 2 message.
  
  @param msg the type 2 message
  @param msgFlags the flags if null then flags are extracted from the
  type 2 message
  @param out the output target for the information
  @throws UnsupportedEncodingException if unable to use the
  needed UTF-16LE or ASCII charsets