void progress ( int cur , int max ) { StringBuilder out = new StringBuilder ( ) ; if ( lastProgress != null ) { char [ ] back = new char [ lastProgress . length ( ) ] ; Arrays . fill ( back , ' ' ) ; out . append ( back ) ; } String progress = cur + "/" + ( max == - 1 ? "?" : "" + max ) + " " + ( max == - 1 ? "(??%)" : "(" + cur * 100 / ( max == 0 ? 1 : max ) + "%)" ) ; if ( cur >= max && max != - 1 ) { progress += " " + loc ( "done" ) + SEPARATOR ; lastProgress = null ; } else { lastProgress = progress ; } out . append ( progress ) ; getOutputStream ( ) . print ( out . toString ( ) ) ; getOutputStream ( ) . flush ( ) ; }
Output a progress indicator to the console .