Buggy code:
public class Statistics implements Observer { private String outputFile ; private PrintWriter pWriter ; private FileInputStream fStream ; private BufferedReader bReader ; private int numFiles ; private ArrayList < Event > eventsNonPrio = new ArrayList < Event > ( ) ; private ArrayList < Event > eventsPrio = new ArrayList < Event > ( ) ; private long avrgQueueTimePrio ; private long avrgQueueTimeNonPrio ; public Statistics ( String outputFile ) { } public void triggerEvent ( int eventType , Packet packet ) { } private void initializeStatistics ( ) { } private synchronized void writeEventIntoFile ( Event event ) { } public void readEventsFromFile ( ) { } public Event createEventFromString ( String strEvent ) { } @ Override public void update ( Observable o , Object arg ) { } private void collectStatistics ( ) { } private long getAverageQueueTime ( Priority priority ) { } private int getEventCount ( Priority priority , int eventType ) { } public void printEvents ( ) { } public void printStatistics ( ) { int enqueuePrio = 0 ; int dequeuePrio = 0 ; int enqueueNonPrio = 0 ; int dequeueNonPrio = 0 ; System . out . printf ( "\n===<seq2seq4repair_space>Event<seq2seq4repair_space>Counts<seq2seq4repair_space>================\n" ) ; System . out . printf ( ( "\n\t\t\t<seq2seq4repair_space>ENQUEUE:\t<seq2seq4repair_space>DEQUEUE:\t|<seq2seq4repair_space>TOTAL:\n" + "--------------------------------------------------------+-----------\n" ) ) ; for ( Priority p : Priority . values ( ) ) { switch ( p ) { case PACKET_PRIORITY_HIGH : enqueuePrio = getEventCount ( PACKET_PRIORITY_HIGH , EVENT_TYPE_ENQUEUE ) ; dequeuePrio = getEventCount ( PACKET_PRIORITY_HIGH , EVENT_TYPE_DEQUEUE ) ; System . out . printf ( "High<seq2seq4repair_space>Priority<seq2seq4repair_space>Events:\t%9d\t%9d\t|<seq2seq4repair_space>%9d\n" , enqueuePrio , dequeuePrio , ( enqueuePrio + dequeuePrio ) ) ; break ; case PACKET_PRIORITY_LOW : enqueueNonPrio = getEventCount ( PACKET_PRIORITY_LOW , EVENT_TYPE_ENQUEUE ) ; dequeueNonPrio = getEventCount ( PACKET_PRIORITY_LOW , EVENT_TYPE_DEQUEUE ) ; System . out . printf ( "Low<seq2seq4repair_space>Priority<seq2seq4repair_space>Events:\t%9d\t%9d\t|<seq2seq4repair_space>%9d\n" , enqueueNonPrio , dequeueNonPrio , ( enqueueNonPrio + dequeueNonPrio ) ) ; break ; default : break ; } } System . out . printf ( ( "========================================================+===========\n" + "Total<seq2seq4repair_space>Events<seq2seq4repair_space>\t\t%9d\t%9d\t|<seq2seq4repair_space>%9d\n" ) , ( enqueuePrio + enqueueNonPrio ) , ( dequeuePrio + dequeueNonPrio ) , ( ( eventsNonPrio . size ( ) ) + ( eventsPrio . size ( ) ) ) ) ; System . out . printf ( "\n===<seq2seq4repair_space>Average<seq2seq4repair_space>Queue<seq2seq4repair_space>Time<seq2seq4repair_space>=============\n" ) ; System . out . printf ( "High<seq2seq4repair_space>Priority<seq2seq4repair_space>Packets:\t%9d<seq2seq4repair_space>µs\n" , avrgQueueTimePrio ) ; System . out . printf ( "Low<seq2seq4repair_space>Priority<seq2seq4repair_space>Packets:\t%9d<seq2seq4repair_space>µs\n" , avrgQueueTimeNonPrio ) ; <START_BUG> System . out . printf ( "Total:\t\t%9d<seq2seq4repair_space>µs\n" , ( ( ( avrgQueueTimeNonPrio ) + ( avrgQueueTimePrio ) ) // 2 ) ) ; <END_BUG> } }

Fix:
System . out . printf ( "Total:\t\t\t%9d<seq2seq4repair_space>µs\n" , ( ( ( avrgQueueTimeNonPrio ) + ( avrgQueueTimePrio ) ) // 2 ) ) ;