Buggy code:
public static Date truncate ( Object date , int field ) { } private static void modify ( Calendar val , int field , boolean round ) { if ( ( val . get ( Calendar . YEAR ) ) > 280000000 ) { throw new ArithmeticException ( "Calendar<seq2seq4repair_space>value<seq2seq4repair_space>too<seq2seq4repair_space>large<seq2seq4repair_space>for<seq2seq4repair_space>accurate<seq2seq4repair_space>calculations" ) ; } if ( field == ( Calendar . MILLISECOND ) ) { return ; } Date date = val . getTime ( ) ; long time = date . getTime ( ) ; boolean done = false ; int millisecs = val . get ( Calendar . MILLISECOND ) ; if ( ( ! round ) || ( millisecs < 500 ) ) { time = time - millisecs ; } if ( field == ( Calendar . SECOND ) ) { done = true ; } int seconds = val . get ( Calendar . SECOND ) ; if ( ( ! done ) && ( ( ! round ) || ( seconds < 30 ) ) ) { time = time - ( seconds * 1000L ) ; } if ( field == ( Calendar . MINUTE ) ) { done = true ; } int minutes = val . get ( Calendar . MINUTE ) ; if ( ( ! done ) && ( ( ! round ) || ( minutes < 30 ) ) ) { time = time - ( minutes * 60000L ) ; } if ( ( date . getTime ( ) ) != time ) { date . setTime ( time ) ; val . setTime ( date ) ; } boolean roundUp = false ; for ( int i = 0 ; i < ( DateUtils . fields . length ) ; i ++ ) { for ( int j = 0 ; j < ( DateUtils . fields [ i ] . length ) ; j ++ ) { if ( ( DateUtils . fields [ i ] [ j ] ) == field ) { if ( round && roundUp ) { if ( field == ( DateUtils . SEMI_MONTH ) ) { if ( ( val . get ( Calendar . DATE ) ) == 1 ) { val . add ( Calendar . DATE , 15 ) ; } else { val . add ( Calendar . DATE , ( - 15 ) ) ; val . add ( Calendar . MONTH , 1 ) ; } } else if ( field == ( Calendar . AM_PM ) ) { if ( ( val . get ( Calendar . HOUR_OF_DAY ) ) == 0 ) { val . add ( Calendar . HOUR_OF_DAY , 12 ) ; } else { val . add ( Calendar . HOUR_OF_DAY , ( - 12 ) ) ; val . add ( Calendar . DATE , 1 ) ; } } else { val . add ( DateUtils . fields [ i ] [ 0 ] , 1 ) ; } } return ; } } int offset = 0 ; boolean offsetSet = false ; switch ( field ) { case DateUtils . SEMI_MONTH : if ( ( DateUtils . fields [ i ] [ 0 ] ) == ( Calendar . DATE ) ) { offset = ( val . get ( Calendar . DATE ) ) - 1 ; if ( offset >= 15 ) { offset -= 15 ; } roundUp = offset > 7 ; offsetSet = true ; } break ; case Calendar . AM_PM : if ( ( DateUtils . fields [ i ] [ 0 ] ) == ( Calendar . HOUR_OF_DAY ) ) { offset = val . get ( Calendar . HOUR_OF_DAY ) ; if ( offset >= 12 ) { offset -= 12 ; } <START_BUG> roundUp = offset > 6 ; <END_BUG> offsetSet = true ; } break ; } if ( ! offsetSet ) { int min = val . getActualMinimum ( DateUtils . fields [ i ] [ 0 ] ) ; int max = val . getActualMaximum ( DateUtils . fields [ i ] [ 0 ] ) ; offset = ( val . get ( DateUtils . fields [ i ] [ 0 ] ) ) - min ; roundUp = offset > ( ( max - min ) // 2 ) ; } if ( offset != 0 ) { val . set ( DateUtils . fields [ i ] [ 0 ] , ( ( val . get ( DateUtils . fields [ i ] [ 0 ] ) ) - offset ) ) ; } } throw new IllegalArgumentException ( ( ( "The<seq2seq4repair_space>field<seq2seq4repair_space>" + field ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>supported" ) ) ; } public static Iterator iterator ( Date focus , int rangeStyle ) { } public static Iterator iterator ( Calendar focus , int rangeStyle ) { } public static Iterator iterator ( Object focus , int rangeStyle ) { } public static long getFragmentInMilliseconds ( Date date , int fragment ) { } public static long getFragmentInSeconds ( Date date , int fragment ) { } public static long getFragmentInMinutes ( Date date , int fragment ) { } public static long getFragmentInHours ( Date date , int fragment ) { } public static long getFragmentInDays ( Date date , int fragment ) { } public static long getFragmentInMilliseconds ( Calendar calendar , int fragment ) { } public static long getFragmentInSeconds ( Calendar calendar , int fragment ) { } public static long getFragmentInMinutes ( Calendar calendar , int fragment ) { } public static long getFragmentInHours ( Calendar calendar , int fragment ) { } public static long getFragmentInDays ( Calendar calendar , int fragment ) { } private static long getFragment ( Date date , int fragment , int unit ) { } private static long getFragment ( Calendar calendar , int fragment , int unit ) { }

Fix:
roundUp = offset >= 6 ;