question: private static int parseInt ( String value , int beginIndex , int endIndex ) throws NumberFormatException { if ( beginIndex < 0 || endIndex > value . length ( ) || beginIndex > endIndex ) { throw new NumberFormatException ( value ) ; } int i = beginIndex ; int result = 0 ; int digit ; if ( i < endIndex ) { digit = Character . digit ( value . charAt ( i ++ ) , 10 ) ; if ( digit < 0 ) { throw new NumberFormatException ( "Invalid number: " + value ) ; } result = - digit ; } while ( i < endIndex ) { digit = Character . digit ( value . charAt ( i ++ ) , 10 ) ; if ( digit < 0 ) { throw new NumberFormatException ( "Invalid number: " + value ) ; } result *= 10 ; result -= digit ; } return - result ; }
target:  Parse an integer located between 2 given offsets in a string