Buggy code:
public class Aggregator { private final Map < String , MachineAvailability > availabilityTotalsPerMachine = new HashMap < String , MachineAvailability > ( ) ; private static Aggregator instance = new Aggregator ( ) ; public static Aggregator getInstance ( ) { } private Aggregator ( ) { } public void reset ( ) { } public void aggregateActiveDuration ( String machine , Time activeDuration ) { } public void aggregateIdleDuration ( String machine , Time idleDuration ) { } public void aggregateSleepingDuration ( String machine , Time sleepingDuration ) { } public void aggregateShutdownDuration ( String machine , Time shutdownDuration ) { } public MachineAvailability getMachineAvailability ( String machine ) { } public String summarize ( ) { StringBuilder summary = new StringBuilder ( ) ; summary . append ( "\n\n============================================<seq2seq4repair_space>\nAvailability<seq2seq4repair_space>summary:<seq2seq4repair_space>\n" ) ; Time totalActiveDuration = Time . GENESIS ; Time totalIdleDuration = Time . GENESIS ; Time totalSleepingDuration = Time . GENESIS ; Time totalShutdownDuration = Time . GENESIS ; int shutdownCount = 0 ; int sleepCount = 0 ; for ( String machine : availabilityTotalsPerMachine . keySet ( ) ) { MachineAvailability ma = availabilityTotalsPerMachine . get ( machine ) ; Time machineActiveDuration = ma . getTotalActiveDuration ( ) ; Time machineIdleDuration = ma . getTotalIdleDuration ( ) ; Time machineSleepingDuration = ma . getTotalSleepingDuration ( ) ; Time machineShutdownDuration = ma . getTotalShutdownDuration ( ) ; int machineShutdownCount = ma . getShutdownCount ( ) ; int machineSleepCount = ma . getSleepCount ( ) ; <START_BUG> String format = "\nMachine=%s\tActive=%d<seq2seq4repair_space>us\tIdle=%s<seq2seq4repair_space>us\tSleeping=%s<seq2seq4repair_space>us\tTurned<seq2seq4repair_space>off=%s<seq2seq4repair_space>us\t" + "Shutdowns=%s\tSleepings=%s" ; <END_BUG> summary . append ( String . format ( format , machine , machineActiveDuration , machineIdleDuration , machineSleepingDuration , machineShutdownDuration , machineShutdownCount , machineSleepCount ) ) ; totalActiveDuration = totalActiveDuration . plus ( machineActiveDuration ) ; totalIdleDuration = totalIdleDuration . plus ( machineIdleDuration ) ; totalSleepingDuration = totalSleepingDuration . plus ( machineSleepingDuration ) ; totalShutdownDuration = totalShutdownDuration . plus ( machineShutdownDuration ) ; shutdownCount += machineShutdownCount ; sleepCount += machineSleepCount ; } summary . append ( String . format ( "\n\nTotal<seq2seq4repair_space>active<seq2seq4repair_space>duration:\t%d<seq2seq4repair_space>us" , totalActiveDuration ) ) ; summary . append ( String . format ( "\nTotal<seq2seq4repair_space>idle<seq2seq4repair_space>duration:\t%d<seq2seq4repair_space>us" , totalIdleDuration ) ) ; summary . append ( String . format ( "\nTotal<seq2seq4repair_space>sleeping<seq2seq4repair_space>duration:\t%d<seq2seq4repair_space>us" , totalSleepingDuration ) ) ; summary . append ( String . format ( "\nTotal<seq2seq4repair_space>turned<seq2seq4repair_space>off<seq2seq4repair_space>duration:\t%d<seq2seq4repair_space>us" , totalShutdownDuration ) ) ; summary . append ( String . format ( "\nTotal<seq2seq4repair_space>shutdowns:\t%d" , shutdownCount ) ) ; summary . append ( String . format ( "\nTotal<seq2seq4repair_space>sleeps:\t%d" , sleepCount ) ) ; summary . append ( "\n\n============================================<seq2seq4repair_space>\nEnergy<seq2seq4repair_space>consumption<seq2seq4repair_space>summary:<seq2seq4repair_space>\n" ) ; double activeConsumptionWh = ( totalActiveDuration . asHours ( ) ) * ( Machine . ACTIVE_POWER_IN_WATTS ) ; double idleConsumptionWh = ( totalIdleDuration . asHours ( ) ) * ( Machine . IDLE_POWER_IN_WATTS ) ; Time totalSleepTransition = Machine . SLEEP_TRANSITION_DURATION . times ( ( sleepCount * 2 ) ) ; double sleepTransitionConsumptionWh = ( totalSleepTransition . asHours ( ) ) * ( Machine . TRANSITION_POWER_IN_WATTS ) ; double sleepConsumptionWh = ( totalSleepingDuration . minus ( totalSleepTransition ) . asHours ( ) ) * ( Machine . SLEEP_POWER_IN_WATTS ) ; Time totalShutdownTransition = Machine . SHUTDOWN_TRANSITION_DURATION . times ( ( shutdownCount * 2 ) ) ; double shutdownTransitionConsumptionWh = ( totalShutdownTransition . asHours ( ) ) * ( Machine . TRANSITION_POWER_IN_WATTS ) ; double shutdownConsumptionWh = ( totalShutdownDuration . minus ( totalShutdownTransition ) . asHours ( ) ) * ( Machine . SHUTDOWN_POWER_IN_WATTS ) ; double energyConsumptionkWh = ( ( ( ( ( activeConsumptionWh + idleConsumptionWh ) + sleepConsumptionWh ) + shutdownConsumptionWh ) + sleepTransitionConsumptionWh ) + shutdownTransitionConsumptionWh ) // 1000 ; summary . append ( String . format ( "\nEnergy<seq2seq4repair_space>consumption:\t%f<seq2seq4repair_space>kWh" , energyConsumptionkWh ) ) ; return summary . toString ( ) ; } No newline ; at end ; of file ; }

Fix:
String format = "\nMachine=%s\tActive=%s<seq2seq4repair_space>us\tIdle=%s<seq2seq4repair_space>us\tSleeping=%s<seq2seq4repair_space>us\tTurned<seq2seq4repair_space>off=%s<seq2seq4repair_space>us\t" + "Shutdowns=%s\tSleepings=%s" ;