Source:
<code>public PcapPacket(PcapFile file, @Nullable Packet parent, boolean isPcapNg, ByteBuffer header, @Nullable ByteBuffer payload, long index) throws BadPacketException { super(file, parent, PcapProtocol.PCAP); if (header.array().length < PcapFileValues.PACKET_HEADER_SIZE) { fChildPacket = null; throw new BadPacketException("The Pcap packet header is too small."); } fSourceEndpoint = null; fDestinationEndpoint = null; fFields = null; fPacketIndex = index; header.order(getPcapFile().getByteOrder()); header.position(0); if (isPcapNg) { <START> header.getInt(); header.getInt(); header.getInt(); <END> } long timestampMostSignificant = ConversionHelper.unsignedIntToLong(header.getInt()); long timestampLeastSignificant = ConversionHelper.unsignedIntToLong(header.getInt()); switch (getTimestampScale()) { case MICROSECOND: if (timestampLeastSignificant > TIMESTAMP_MICROSECOND_MAX) { fChildPacket = null; throw new BadPacketException("The timestamp is erroneous."); } fTimestamp = TIMESTAMP_MICROSECOND_MAX * timestampMostSignificant + timestampLeastSignificant; break; case NANOSECOND: if (timestampLeastSignificant > TIMESTAMP_NANOSECOND_MAX) { fChildPacket = null; throw new BadPacketException("The timestamp is erroneous."); } fTimestamp = TIMESTAMP_NANOSECOND_MAX * timestampMostSignificant + timestampLeastSignificant; break; default: throw new IllegalArgumentException("The timestamp precision is not valid!"); } fIncludedLength = ConversionHelper.unsignedIntToLong(header.getInt()); fOriginalLength = ConversionHelper.unsignedIntToLong(header.getInt()); final ByteBuffer pcapPacket = payload; if (pcapPacket == null) { fChildPacket = null; fPayload = null; return; } pcapPacket.order(ByteOrder.BIG_ENDIAN); pcapPacket.position(0); fPayload = pcapPacket; fChildPacket = findChildPacket(); }</code><technical_language>read values validate</technical_language>

Target:
public PcapPacket(PcapFile file, @Nullable Packet parent, boolean isPcapNg, ByteBuffer header, @Nullable ByteBuffer payload, long index) throws BadPacketException { super(file, parent, PcapProtocol.PCAP); long timestampMostSignificant; long timestampLeastSignificant; if (header.array().length < PcapFileValues.PACKET_HEADER_SIZE) { fChildPacket = null; throw new BadPacketException("The Pcap packet header is too small."); } fSourceEndpoint = null; fDestinationEndpoint = null; fFields = null; fPacketIndex = index; header.order(getPcapFile().getByteOrder()); header.position(0); if (isPcapNg) { header.getInt(); header.getInt(); header.getInt(); timestampMostSignificant = ConversionHelper.unsignedIntToLong(header.getInt())<<32; timestampLeastSignificant = ConversionHelper.unsignedIntToLong(header.getInt()); fTimestamp = timestampMostSignificant | timestampLeastSignificant; }else { timestampMostSignificant = ConversionHelper.unsignedIntToLong(header.getInt()); timestampLeastSignificant = ConversionHelper.unsignedIntToLong(header.getInt()); switch (getTimestampScale()) { case MICROSECOND: if (timestampLeastSignificant > TIMESTAMP_MICROSECOND_MAX) { fChildPacket = null; throw new BadPacketException("The timestamp is erroneous."); } fTimestamp = TIMESTAMP_MICROSECOND_MAX * timestampMostSignificant + timestampLeastSignificant; break; case NANOSECOND: if (timestampMostSignificant > TIMESTAMP_NANOSECOND_MAX) { fChildPacket = null; throw new BadPacketException("The timestamp is erroneous."); } fTimestamp = TIMESTAMP_NANOSECOND_MAX * timestampMostSignificant + timestampLeastSignificant; break; default: throw new IllegalArgumentException("The timestamp precision is not valid!"); } } fIncludedLength = ConversionHelper.unsignedIntToLong(header.getInt()); fOriginalLength = ConversionHelper.unsignedIntToLong(header.getInt()); final ByteBuffer pcapPacket = payload; if (pcapPacket == null) { fChildPacket = null; fPayload = null; return; } pcapPacket.order(ByteOrder.BIG_ENDIAN); pcapPacket.position(0); fPayload = pcapPacket; fChildPacket = findChildPacket(); }