question: private ArrayList < Integer > calcLabels ( ) { float [ ] borderValues = calcBorderValues ( ) ; float minValue = borderValues [ 0 ] ; float maxValue = borderValues [ 1 ] ; if ( minLabelValue == 0 && maxLabelValue == 0 ) { if ( maxValue < 0 ) maxLabelValue = 0 ; else maxLabelValue = ( int ) Math . ceil ( maxValue ) ; if ( minValue > 0 ) minLabelValue = 0 ; else minLabelValue = ( int ) Math . floor ( minValue ) ; while ( ( maxLabelValue - minLabelValue ) % step != 0 ) maxLabelValue += 1 ; if ( minLabelValue == maxLabelValue ) maxLabelValue += step ; } ArrayList < Integer > result = new ArrayList < > ( ) ; int pos = minLabelValue ; while ( pos <= maxLabelValue ) { result . add ( pos ) ; pos += step ; } if ( result . get ( result . size ( ) - 1 ) < maxLabelValue ) result . add ( maxLabelValue ) ; return result ; }
target:  Get labels based on the maximum value displayed