Here you can find the source of charToHexdigit(final byte c)
Parameter | Description |
---|---|
c | the character to be converted |
public static int charToHexdigit(final byte c)
//package com.java2s; /****************************************************************************** * Copyright (c) 2000-2017 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ public class Main { /**/* w w w . j a va2 s . c o m*/ * Converts the provided character into a hexadecimal value. * * @param c * the character to be converted * * @return the hexadecimal value. * */ public static int charToHexdigit(final byte c) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'A' && c <= 'F') { return c - 'A' + 10; } else { return c - 'a' + 10; } } }