Here you can find the source of toByte(final String strHexa)
Parameter | Description |
---|---|
strHexa | - String in a HexaDecimal |
public static final byte toByte(final String strHexa)
//package com.java2s; /*//from w w w . j av a 2s.c om * @(#)HexaDecimalUtils.java 0.2 10/11/22 * Copyright (c) 2010 Felipe Priuli * * This file is part of OpenSutils-Br4J. * * OpenSutils-Br4J is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, any later version. * * OpenSutils-Br4J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Foobar. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Converts a hexadecimal String to a byte * @param strHexa - String in a HexaDecimal * @return String in HexaDecimal */ public static final byte toByte(final String strHexa) { return ((byte) (Short.parseShort(strHexa.toUpperCase(), 16))); } }