Buggy code:
public class Client { int clientPort = 1337 ; int windowSize = 1024 ; int maximumSequenceNumber ; int windowStart = 0 ; int nextPacket = 0 ; InetAddress serverIP ; int serverOutputPort = - 1 ; int serverInputPort = 1338 ; public void run ( ) { DatagramSocket receiverSocket ; try { receiverSocket = new DatagramSocket ( clientPort ) ; byte [ ] receiveData = new byte [ 2 ] ; DatagramPacket receivePacket = new DatagramPacket ( receiveData , receiveData . length ) ; while ( ( serverOutputPort ) == ( - 1 ) ) { Utilities . receivePacket ( receiverSocket , receivePacket ) ; serverIP = receivePacket . getAddress ( ) ; serverOutputPort = receivePacket . getPort ( ) ; windowSize = receiveData [ 0 ] ; maximumSequenceNumber = receiveData [ 1 ] ; } System . out . println ( ( "Received<seq2seq4repair_space>packet<seq2seq4repair_space>from<seq2seq4repair_space>sender,<seq2seq4repair_space>sender<seq2seq4repair_space>IP<seq2seq4repair_space>is<seq2seq4repair_space>" + ( serverIP ) ) ) ; System . out . println ( ( ( ( "Max<seq2seq4repair_space>window<seq2seq4repair_space>size<seq2seq4repair_space>is<seq2seq4repair_space>" + ( windowSize ) ) + "<seq2seq4repair_space>and<seq2seq4repair_space>max<seq2seq4repair_space>sequence<seq2seq4repair_space>number<seq2seq4repair_space>is<seq2seq4repair_space>" ) + ( maximumSequenceNumber ) ) ) ; char [ ] packetLog = new char [ maximumSequenceNumber ] ; for ( int i = 0 ; i < ( packetLog . length ) ; i ++ ) { packetLog [ i ] = 'n' ; } byte [ ] sendData = new byte [ 1 ] ; DatagramPacket sendPacket = new DatagramPacket ( sendData , sendData . length , serverIP , serverInputPort ) ; DatagramSocket sendingSocket = new DatagramSocket ( serverInputPort ) ; Utilities . sendPacket ( sendingSocket , sendPacket ) ; System . out . println ( ( ( ( ( ( "Sent<seq2seq4repair_space>packet<seq2seq4repair_space>with<seq2seq4repair_space>one<seq2seq4repair_space>byte,<seq2seq4repair_space>" + sendData ) + "<seq2seq4repair_space>to<seq2seq4repair_space>IP<seq2seq4repair_space>" ) + ( serverIP ) ) + "<seq2seq4repair_space>port<seq2seq4repair_space>" ) + ( serverInputPort ) ) ) ; System . out . println ( ( ( ( ( ( "Waiting<seq2seq4repair_space>for<seq2seq4repair_space>packet<seq2seq4repair_space>" + ( nextPacket ) ) + ",<seq2seq4repair_space>window<seq2seq4repair_space>of<seq2seq4repair_space>size<seq2seq4repair_space>" ) + ( windowSize ) ) + "<seq2seq4repair_space>starting<seq2seq4repair_space>at<seq2seq4repair_space>" ) + ( windowStart ) ) ) ; while ( true ) { byte [ ] nextData = new byte [ 1 ] ; DatagramPacket next = new DatagramPacket ( nextData , nextData . length ) ; receiverSocket . receive ( next ) ; if ( ( nextData [ 0 ] ) > 0 ) { int seqNum = ( receiveData [ 0 ] ) - 1 ; System . out . print ( ( ( "Packet<seq2seq4repair_space>" + seqNum ) + "<seq2seq4repair_space>received.<seq2seq4repair_space>" ) ) ; packetLog [ seqNum ] = 'r' ; if ( ( nextData [ 0 ] ) < ( ( windowSize ) + ( windowStart ) ) ) { DatagramPacket out = new DatagramPacket ( nextData , nextData . length , serverIP , serverInputPort ) ; Utilities . sendPacket ( sendingSocket , out ) ; System . out . print ( ( "<seq2seq4repair_space>Sent<seq2seq4repair_space>ACK<seq2seq4repair_space>for<seq2seq4repair_space>" + seqNum ) ) ; packetLog [ seqNum ] = 'a' ; System . out . println ( ( "<seq2seq4repair_space>Window<seq2seq4repair_space>at<seq2seq4repair_space>sequence<seq2seq4repair_space>number<seq2seq4repair_space>" + ( windowStart ) ) ) ; System . out . print ( "Sequence<seq2seq4repair_space>number:<seq2seq4repair_space>" ) ; for ( int i = 0 ; i < ( packetLog . length ) ; i ++ ) { System . out . print ( ( i + ",<seq2seq4repair_space>" ) ) ; } System . out . println ( ) ; System . out . print ( "Packet<seq2seq4repair_space>log:<seq2seq4repair_space>" ) ; for ( int i = 0 ; i < ( packetLog . length ) ; i ++ ) { if ( i == ( windowStart ) ) { System . out . print ( "[" ) ; } System . out . print ( ( ( packetLog [ i ] ) + ",<seq2seq4repair_space>" ) ) ; if ( i == ( ( windowStart ) + ( ( windowSize ) - 1 ) ) ) { System . out . print ( "]" ) ; } } <START_BUG> out . println ( ) ; <END_BUG> } } ( nextPacket ) ++ ; } } catch ( Exception e ) { System . out . println ( e ) ; } } private void getNextPacket ( int nextPacket , int windowStart ) { } No newline ; at end ; of file ; }

Fix:
System . out . println ( ) ;