Java Digit From toDigit(char ch)

Here you can find the source of toDigit(char ch)

Description

Converts the character to a digit, throws an IllegalStateException if it isn't a valid digit.

License

Apache License

Declaration

private static int toDigit(char ch) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*w  w w .j a va2  s  . c  om*/
     * Converts the character to a digit, throws an IllegalStateException if it isn't a
     * valid digit.
     */
    private static int toDigit(char ch) {
        if (('0' <= ch) && (ch <= '9')) {
            return ch - '0';
        }
        throw new IllegalStateException();
    }
}

Related

  1. toDigit(char c)
  2. toDigit(char ch, int index)
  3. toDigit(final boolean bit)
  4. toDigit(final char ch, final int index)
  5. toDigit(final char ch, final int index)