Java Byte Create toByte(char c)

Here you can find the source of toByte(char c)

Description

to Byte

License

Open Source License

Declaration

private static int toByte(char c) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static int toByte(char c) {
        if (c >= '0' && c <= '9')
            return (c - '0');
        if (c >= 'A' && c <= 'F')
            return (c - 'A' + 10);
        if (c >= 'a' && c <= 'f')
            return (c - 'a' + 10);

        throw new RuntimeException("Invalid hex char '" + c + "'");
    }/*from  w  ww  .j  a v  a2s  .  c o m*/
}

Related

  1. toByte(byte[] src)
  2. toByte(byte[] value)
  3. toByte(char c)
  4. toByte(char c)
  5. toByte(char c)
  6. toByte(char hex)
  7. toByte(double x, double gamma)
  8. toByte(final byte[] buffer, final int offset)
  9. toByte(final int highNibble, final int lowNibble)