Java Utililty Methods Hex Convert To

List of utility methods to do Hex Convert To

Description

The list of methods to do Hex Convert To are organized into topic(s).

Method

intconvertHex(char c)
convert Hex
if ('0' <= c && c <= '9') {
    return c - '0';
if ('a' <= c && c <= 'f') {
    return c - 'a' + 10;
return c - 'A' + 10;
StringconvertHexa(String bool)
Convert a Bool String as a Hexa String
return Integer.toString(Integer.parseInt(bool, 2), 16);
StringconvertHexadecimal2RGB(final String hexColor, final String divider)
convert Hexadecimal RGB
final String hex = hexColor.replaceFirst("#", "");
if (hex.length() != 6) {
    return null;
final StringBuilder sb = new StringBuilder();
String toCon = hex.substring(0, 2);
int color = Integer.parseInt(toCon, 16);
sb.append(color);
...
StringconvertHexByteToTelcoChar(byte byteValue)
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 (#).
switch (byteValue) {
case 11:
    return "*";
case 12:
    return "#";
default:
    return String.format("%1x", Byte.valueOf(byteValue));
StringconvertHexChars(final String value)
turn any hex values (ie #e4) into chars
if (value == null) {
    return value;
final int escapeChar = value.indexOf(hashInt);
if (escapeChar == -1) {
    return value;
final StringBuilder newString = new StringBuilder();
...
Integer[]convertHexColorToRgb(final String hex)
Convert a String hex color in #FFF or #FFFFFF format, returning an array of 3 integers representing the corresponding RGB color (in this order).
if (!hex.matches("^#[abcdefABCDEF0-9]{6}|#[abcdefABCDEF0-9]{3}")) {
    return new Integer[] {};
final String hexCode;
if (hex.length() == 4) {
    char[] chars = hex.toCharArray();
    char[] normalizedChars = new char[] { '#', chars[1], chars[1], chars[2], chars[2], chars[3], chars[3] };
    hexCode = new String(normalizedChars);
...
longconvertHexFloatingPointLiteralToBits(char[] source)
Returns the given hexadecimal floating-point literal as the bits for a single-precision (float) or a double-precision (double) IEEE floating point number.
int length = source.length;
long mantissa = 0;
int next = 0;
char nextChar = source[next];
nextChar = source[next];
if (nextChar == '0') {
    next++;
} else {
...
longconvertHexLong(String hex)
Convert hex to long.
boolean isNegative = false;
if (hex.startsWith("+")) {
    hex = hex.substring(1);
} else if (hex.startsWith("-")) {
    hex = hex.substring(1);
    isNegative = true;
if (hex.startsWith("0x") || hex.startsWith("0X")) {
...
byte[]convertHexStringToBinary(String hexString)
Convert the provided hex-string into a binary representation where each byte represents two characters of the hex string.
int length = hexString.length();
if (length % 2 != 0) {
    throw new IllegalArgumentException("The provided hex String must be an even length, but was of length "
            + length + ": " + hexString);
byte[] binary = new byte[length / 2];
for (int i = 0; i < length; i += 2) {
    char highBitsChar = hexString.charAt(i);
...
StringconvertHexTime2Binary(String timespan)
convert Hex Time Binary
if (timespan == null || timespan.equals("")) {
    return "";
String tmp = "";
String ret = "";
String[] strArr = timespan.split(",");
for (int i = 0; i < strArr.length; i++) {
    String binStr = Long.toBinaryString(Long.parseLong(strArr[i], 16));
...