Skip to content
Advertisement

Tag: hex

Scanner for hex-input not working as expected inside loop

I need to solve this problem where i need to convert hexadecimal numbers to decimals. Issue I have compiled it without any errors, but my output came out wrong. Can someone show how to fix these errors? Code Example Input: Expected Output: Output that i got: Answer Your solution is close. Here are changes to make so that it runs

Hexadecimal byte array from a Midi event to int

I’m trying to retrieve the tempo of a midi file through the javax.midi library. What I am expected to receive is an array of three ex, because the Set Tempo meta message (which is this case, has just 3 bytes specifying a miliseconds amount. This is how the midi event returns So if you join them you have 0x07A120 which

Is this a valid Hex value?

I’m reading a series of Hex values, reading the value `0x03B6 using the code : results in exception : If however I remove the 0x at beginning of value the result is converted to HEX correctly : Is 0X a convention to indicate it’s a hex value ? 03B6 is valid Hex ? Using a Hex calculator – https://www.calculator.net/hex-calculator.html also

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

Convert Decimal (Base 10) to Hexadecimal (Base 16) in Java

My question is about Java. How can I convert Decimal (Base 10) to Hexadecimal (Base 16) in Java with Java 7? When I use in C# the method Convert.FromBase64String(str) with String “BQoPFBke” i get the result: 05-0A-0F-14-19-1E But when I use in Java the method Base64.Decoder.decode(str) with the same String I get the result: [5, 10, 15, 20, 25, 30]

Java hex calculation

I have the long value bits declared like so: long bits = len*8L; (304) System.out.println(bits); This outputs as 304 If I use the long name bits like so I get 0 & 0 respectively. If I use the actual number, like so, I get 304 and 48 respectively I’m trying to convert this Java to JavaScript but JavaScript gives me

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

How to convert date time in hex in android

I need to convert date and time in hex code for writing it on IOT device. Here is my code It is returning 11 digits hex code I need 8 digits, just like date and time in hex is 47C7EDE0 for this date 12:34:56 29/Feb/2008 Please help Answer Try this:

How can i put a string in one line

i’m doing some conversion, from Hex to Ascii, when i convert the string, i got the following example: F23C040100C1 100D200000000000 0000 I know that the string is coming like this, because of the base 16, but i want too put it in just one line, like this: F23C040100C1100D2000000000000000 How can i do that? I have tried: Answer There are multiple

Difference between 0x0A and 0x0D

I was studying about bluetooth and I was trying to write the code to keep listening to the input stream while connected and i came across this following code snippet: Can someone explain what is the difference between 0x0A and 0x0D. And also give a brief explanation about this code. Kindly share your views. Answer The values starting 0x are

Advertisement