Here you can find the source of convertHexDigit(byte b)
Parameter | Description |
---|---|
b | An ASCII encoded character 0-9 a-f A-F |
public static byte convertHexDigit(byte b)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { /** //w ww. j a va2 s . c o m * @param b An ASCII encoded character 0-9 a-f A-F * @return The byte value of the character 0-16. */ public static byte convertHexDigit(byte b) { if ((b >= '0') && (b <= '9')) return (byte) (b - '0'); if ((b >= 'a') && (b <= 'f')) return (byte) (b - 'a' + 10); if ((b >= 'A') && (b <= 'F')) return (byte) (b - 'A' + 10); return 0; } }