Java Hex Convert To convertHexByteToTelcoChar(byte byteValue)

Here you can find the source of convertHexByteToTelcoChar(byte byteValue)

Description

Converts byte into telco specific char according to statement If the BCD even or BCD odd encoding scheme is used, then the following encoding shall be applied for the non-decimal characters: 1011 (*), 1100 (#).

License

Open Source License

Parameter

Parameter Description
byteValue byte value to convert into char

Declaration

public static String convertHexByteToTelcoChar(byte byteValue) 

Method Source Code

//package com.java2s;
/*/*w w w .j ava  2 s  . c  o m*/
 * TeleStax, Open Source Cloud Communications
 * Copyright 2011-2016, Telestax Inc and individual contributors
 * by the @authors tag.
 *
 * This program is free software: you can redistribute it and/or modify
 * under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

public class Main {
    /**
     * Converts byte into telco specific char according to statement
     * If the BCD even or BCD odd encoding scheme is used, then the following encoding shall be applied for the
     * non-decimal characters: 1011 (*), 1100 (#).
     * 11=b=*
     * 12=c=#
     *
     * @param byteValue byte value to convert into char
     * @return
     */
    public static String convertHexByteToTelcoChar(byte byteValue) {
        switch (byteValue) {
        case 11:
            return "*";
        case 12:
            return "#";
        default:
            return String.format("%1x", Byte.valueOf(byteValue));
        }
    }
}

Related

  1. convertHex(char c)
  2. convertHexa(String bool)
  3. convertHexadecimal2RGB(final String hexColor, final String divider)
  4. convertHexChars(final String value)
  5. convertHexColorToRgb(final String hex)
  6. convertHexFloatingPointLiteralToBits(char[] source)
  7. convertHexLong(String hex)