hexadecimal

Hexadecimal numpad

The project I am currently working on requires a lot of hexadecimal numbers to be entered into the code. I once saw a pic of an old keyboard with a hexadecimal numpad (has A-F letters on it also) replacing the normal numpad. Anyone know where I can get one of these? ...

Convert hex character to decimal equivelant in MIPs?

How do I take a single ASCII character and convert it to its decimal equivelant in MIPs? Do I simply have to have some conditions to subtract a certain amount from the ascii code to make it its decimal representation? ...

Java negative int to hex and back fails

Hello, public class Main3 { public static void main(String[] args) { Integer min = Integer.MIN_VALUE; String minHex = Integer.toHexString(Integer.MIN_VALUE); System.out.println(min + " " + minHex); System.out.println(Integer.parseInt(minHex, 16)); } } Gives -2147483648 80000000 Exception in thread "main"...

Is there a function that returns the ASCII value of a character? (C++)

I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc... On a similar note, what is the function that converts between hexadecimal, decimal, and binary numbers? ...

How do I generate character sequences like hexadecimal with a different base?

I have the following Perl script that generates a string based on a number: my @chars; push @chars, map(chr, 48..57), map(chr, 97..122); my $c = $#chars+1; for (0..50) { my $string; my $l = $_ / $c; my $i = int $l; my $r = ($l - $i) * $c; $string .= $chars[$r]; while ($i > 0) { $l = $i / $c; $i =...

Convert A String (like testing123) To Binary In Java

I would like to be able to convert a String (with words/letters) to other forms, like binary. How would I go about doing this. I am coding in BLUEJ (Java). Thanks ...

Converting A String To Hexadecimal In Java

I am trying to convert a string like "testing123" into hexadecimal form in java. I am currently using BlueJ. And to convert it back, is it the same thing except backward? ...

Converting very large decimal numbers to hexadecimal (1.67119535743*10^33)

I'm curious as to if it'd be possible to convert a very, very large decimal number such as 1.67119535743*10^33/1.67119535743E+33 to hexadecimal via PHP or C#. All my previous attempts have failed, unfortunately. Thanks to all in advance! ...

1-digit hexadecimal convertion in c#?

I would like to convert an Int32 in the range 0-15 into a the corresponding char in hexadecimal. One really dummy solution consists in writing var hex = new[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; var myCharInHex = hex[myValue]; Yet, this solution looks plain wrong, any bet...

Can someone explain the conversion from byte array to hex string?

I recently started looking at MD5 hashing (in Java) and while I've found algorithms and methods to help me accomplish that, I'm left wondering how it actually works. For one, I found the following from this URL: private static String convertToHex(byte[] data) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.len...

Randomly generated hexadecimal number in C#

How can I generate a random hexadecimal number with a length of my choice using C#? ...

C++ convert hex string to signed integer

I want to convert a hex string to a 32 bit signed integer in C++. So, for example, I have the hex string "fffefffe". The binary representation of this is 11111111111111101111111111111110. The signed integer representation of this is: -65538. How do I do this conversion in C++? This also needs to work for non-negative numbers. F...

How to convert hex string to float in Java?

How to convert hexadecimal string to single precision floating point in Java? For example, how to implement: float f = HexStringToFloat("BF800000"); // f should now contain -1.0 I ask this because I have tried: float f = (float)(-1.0); String s = String.format("%08x", Float.floatToRawIntBits(f)); f = Float.intBitsToFloat(Integer.valu...

Convert a single hex character to its byte value in java

I have a single hexadecimal character, say char c = 'A'; What's the proper way of converting that to its integer value int value =??; assert(a == 10); Doesn't matter really for now if a is an int or a byte. ...

Python - How to edit hexadecimal file byte by byte

I want to be able to open up an image file and extra the hexadecimal values byte-by-byte. I have no idea how to do this and googling "python byte editing" and "python byte array" didn't come up with anything, surprisingly. Can someone point me towards the library i need to use, specific methods i can google, or tutorials/guides? ...

Given a background color, black or white text?

I'm trying to find a method for determining whether to use black or white text, given a background color (as a hex value). Has anyone dealt with this before? Is there an effective way to do this? In my case, I would be using PHP to implement the logic (though any experience with this in other languages is welcome). ...

VB.net Hexadecimal to 8-bit unsigned array

I have a hexadecimal value 07A5953EE7592CE8871EE287F9C0A5FBC2BB43695589D95E76A4A9D37019C8 which I want to convert to a byte array. Is there a built in function in .NET 3.5 that will get the job done or will I need to write a function to loop through each pair in the string and convert it to its 8-bit integer equivalent? ...

How do I get the Hex Code of a color on my webpage

I have a web page which has a pic. That pic has a color. I need the hex code of the color in that pic. How can I get it? ...

Hex offsets, can someone help?

I'm confused about offsets. If someone tells me to edit something at the offset "0x0805F4B0", what would I type in my hex editor's "Jump To" function? ...

(Java) Write decimal/hex to a file, and not string

If I have a file, and I want to literally write '42' to it (the value, not the string), which for example is 2a in hex, how do I do it? I want to be able to use something like outfile.write(42) or outfile.write(2a) and not write the string to the file. (I realize this is a simple question but I can't find the answer of google, probably ...