If you give values to Real.valueOf(CharSequence) that start with -0. the answer
is positive. This is since the value before the decimal point is interpreted as
an integer and is checked later for being negative - which does not work if it
is zero. A consequence is that the same error appears at
FloatingPoint.valueOf(CharSequence) as well.
To fix this one can insert the following 3 lines at the start of the function:
if ('-' == chars.charAt(0))