Skip to content

Tag: hex

Hex to Cyrillic text

I have hex byte string like “D09FD0B5D180D0BDD0B8D0BA” this is “Перник”. For each letter of the Cyrillic alphabet, I need 2 bytes. For “П” I need “D0 9F”. If I use: My problem is how from hex “D0 9F” to get int value “1055”. Or how from “D09FD0B5D180D0BDD0B8D0BA” to convert to “Перник”. Answer You didn’t specified the encoding, however it appears

How can I mask a hexadecimal int using Java?

I have an integer that contains a hexa value. I want to extract the first characters from this hexa value like it was a String value but I don’t want to convert it to a String. In my case I can’t use String utilities like substring. Answer It’s important to understand that an integer is just a number. There’s no

Convert Decimal to Hex using Recursive method Java

I need to make a recursive method that converts a decimal into hexadecimal. I can’t use Integer.toHexString. EDIT:I tried this code but it doesn’t work properly Edit: Changed the default case and the if (n == 0) loop return statement and it works beautifully now. new code: Answer The problem is in your default clause: it should read: That will

Compute hex color code for an arbitrary string

Heading Is there a way to map an arbitrary string to a HEX COLOR code. I tried to compute the HEX number for string using string hashcode. Now I need to convert this hex number to six digits which are in HEX color code range. Any suggestions ? Answer If you don’t really care about the “meaning” of the color