@Override
  public String toString() {
    int urgentPointerBit = flags >>> 5 & 1;
    int ackBit = flags >>> 4 & 1;
    int pushBit = flags >>> 3 & 1;
    int resetBit = flags >>> 2 & 1;
    int synBit = flags >>> 1 & 1;
    int finBit = flags & 1;
    
    return makeText("TCP",
        "----- TCP Header -----",
        "",
        f("Source port = %d", sourcePort),
        f("Destination port = %d", destPort),
        f("Sequence number = %d", sequenceNumber),
        f("Acknowledgement number = %d", ackNumber),
        f("Header length = %d", headerLength),
        f("Flags = 0x%x", flags),
        f("  ..%d..... = %s", urgentPointerBit, urgentPointerBit == 1 ? "Urgent pointer" : "No urgent pointer"),
        f("  ...%d.... = %s", ackBit, ackBit == 1 ? "Ackowledgement" : "No acknowledgement"),
        f("  ....%d... = %s", pushBit, pushBit == 1 ? "Push" : "No push"),
        f("  .....%d.. = %s", resetBit, resetBit == 1 ? "Reset" : "No reset"),
        f("  ......%d. = %s", synBit, synBit == 1 ? "Syn" : "No syn"),
        f("  .......%d = %s", finBit, finBit == 1 ? "Fin" : "No fin"),
        f("Window size = %d", advertizedWindowSize));
  }