Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4387647

Error in documentation for Character.forDigit(int, int)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • docs
    • beta
    • generic
    • generic



      Name: boT120536 Date: 11/09/2000


      java version "1.3"

      The documentation for the Character.forDigit(int, int) method, located at
      http://java.sun.com/j2se/1.3/docs/api/java/lang/Character.html has an error.
       The documentation block states:
      "The digit argument is valid if 0 <= digit <= radix."

       This is incorrect. It should read:
       "The digit argument is valid if 0 <= digit < radix."
       -----
       In any base-n numbering system, the value n is represented
       by the two digit
       number "10".

       Therefore, there is no single digit that could possibly be
       returned by
       Character.forDigit(n, n), though the docs state that 'a' + n will be
       returned.
       -----
       It is possible that Character.forDigit never gets called
       with equivalent
       parameters, since the first parameter is probably a result
       if some number
       MOD the second parameter, which will always yield a number
        less than the
       second parameter. In that sense, it is likely that no
       other code needs to
       be changed if the Character.forDigit()'s method code is
       incorrect and
       changed.
      (Review ID: 111359)
      ======================================================================

            shommel Scott Hommel (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: