Java ASCII asciiValue(byte b)

Here you can find the source of asciiValue(byte b)

Description

ascii Value

License

Apache License

Declaration

public static int asciiValue(byte b) 

Method Source Code

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

public class Main {
    public static int asciiValue(byte b) {
        if ((b >= '0') && (b <= '9')) {
            return (b - '0');
        }//from   w ww  . j  av a 2  s.  co  m
        if ((b >= 'a') && (b <= 'f')) {
            return (b - 'a') + 0x0a;
        }
        if ((b >= 'A') && (b <= 'F')) {
            return (b - 'A') + 0x0a;
        }

        try {
            throw new Exception();
        } catch (Exception ex) {
        }
        return -1;
    }
}

Related

  1. asciiString(String fourcc)
  2. AsciiStringToString(String content)
  3. asciiToBCD(byte[] ascii, int asc_len)
  4. asciiToEbcdic(String s)
  5. ASCIIToInteger(String ascii)