Here you can find the source of toHexChar(int digitValue)
Parameter | Description |
---|---|
digitValue | a parameter |
public static char toHexChar(int digitValue)
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 MadRobot./*from w ww . j av a 2 s.co m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Elton Kent - initial API and implementation ******************************************************************************/ public class Main { /** * Convert a digital value to hex * * @param digitValue * @return Character representing the given integer */ public static char toHexChar(int digitValue) { if (digitValue < 10) { // Convert value 0-9 to char 0-9 hex char return (char) ('0' + digitValue); } else { // Convert value 10-15 to A-F hex char return (char) ('A' + (digitValue - 10)); } } }