private JsonToken decodeNumber ( char [ ] chars , int offset , int length ) { int i = offset ; int c = chars [ i ] ; if ( c == ' ' ) { c = chars [ ++ i ] ; } if ( c == ' ' ) { c = chars [ ++ i ] ; } else if ( c >= ' ' && c <= ' ' ) { c = chars [ ++ i ] ; while ( c >= ' ' && c <= ' ' ) { c = chars [ ++ i ] ; } } else { return JsonToken . STRING ; } if ( c == ' ' ) { c = chars [ ++ i ] ; while ( c >= ' ' && c <= ' ' ) { c = chars [ ++ i ] ; } } if ( c == ' ' || c == ' ' ) { c = chars [ ++ i ] ; if ( c == ' ' || c == ' ' ) { c = chars [ ++ i ] ; } if ( c >= ' ' && c <= ' ' ) { c = chars [ ++ i ] ; while ( c >= ' ' && c <= ' ' ) { c = chars [ ++ i ] ; } } else { return JsonToken . STRING ; } } if ( i == offset + length ) { return JsonToken . NUMBER ; } else { return JsonToken . STRING ; } }
Determine whether the characters is a JSON number . Numbers are of the form - 12 . 34e + 56 . Fractional and exponential parts are optional . Leading zeroes are not allowed in the value or exponential part but are allowed in the fraction .