hex « hexadecimal « Java Data Type Q&A





1. How to Parse Negative Long in Hex in Java    stackoverflow.com

We have a J2ME application that needs to read hex numbers. The application is already too big for some phones so We try not to include any other codec or write ...

2. Encrypt a hex string in java    stackoverflow.com

I would like to ask for any suggestions about my problem. I need to encrypt a hexadecimal string. I must not to use the built-in functions of java because it doesn't ...

3. Read Java in as Hex    stackoverflow.com

I have tried to solve this but I keep coming up with stuff that is no help I'm sure this is easy (when you know how of course ;) ) What ...

4. Where do you add 'commons-codec-1.4.jar' to if you want access to encodeHexString etc?    stackoverflow.com

Hey, this question links into another post I made today: Reading the first 10 bytes of a file in Java Having been told that my solution could involve the apache ...

5. reducing code.. to function    stackoverflow.com

public final byte[] getParam(String commandName,String memLocation,String dataId){
    byte[] result = new byte[9];
    result[0] = START_FRAME.getBytes()[0];
    result[1] = START_FRAME.getBytes()[0];
    result[2] ...

6. Cellular automata on a Hex grid    stackoverflow.com

I'm learning java so I try to code a basic cellular automata on a hexgrid. I want to separate display code from simulation code so the simulation just process calculations and the ...

7. How can i divide a hex string into two parts?    stackoverflow.com

it is possible to divide an hexadecimal srting in two parts,specifically i have the string variable take values like that var=xxxxyyyy.I need to divide this in two parts,on var1=xxxx and var2=yyyy ...

8. Java Hexa Complement    stackoverflow.com

How does one obtain the complementary hexadecimal value for a given input ? This could be a bit more generic, i.e. having an array of X possible values, how do you convert ...

9. Java How to remove carriage return (HEX 0A) from String?    stackoverflow.com

If a particular String contains a newline character that is invisible (not \n but is 0A in hexadecimal because this value is passed down from the database), how can i able ...





10. hex string question    coderanch.com

If you're in JDK 1.4 or later look at regular expressions, starting with the Pattern class in the JavaDoc. If the hex values represent reasonably sized numbers - and not megabytes of memory or something - you could try to create a new Integer or Long with the appropriate parse**** method and base 16. That will throw an exception if the ...

12. Variables names in Hex and Octal form    coderanch.com

Hello, Can we write a variable name with Hex or Octal notation ? I tried the following. int \u00C1 = 10; int \u0041 = 15; System.out.println("number is " + \u00C1); System.out.println("number is " + \u0041); and it works fine. But when i tried to include the following statment the compiler throws me error. int \101 = 10; //octal value for 'A' ...

13. Mathematical Operation on Hex String    coderanch.com

14. Printing in Hex    coderanch.com

15. shift operators and hex...HELP!!!!!    coderanch.com

Could someone explain (in P.E. major language ) why the answer is f? I included the explanation, but it doesn't really make a lot of sense! class EBH019 { public static void main (String args[]) { int i1 = 0xffffffff, i2 = i1 << 1; int i3 = i1 >> 1, i4 = i1 >>> 1; System.out.print(Integer.toHexString(i2) + ","); System.out.print(Integer.toHexString(i3) + ...

16. Read, translate to hex, write?    coderanch.com





17. Return a (non-String) hex?    coderanch.com

What exactly were you after? How would you incorporate hex digits a - f if you returned (say) an int? The way a number is stored in memory and the way it's represented are very distinct - toString returns base 10, toHexString returns base 16 etc, but internally ints are stored in base 2. When you get an int return, the ...

18. Couple quick questions about octel and hex notation    coderanch.com

Hi all, Im trying to understand what the '0x' in lets say 0x0F stands for... Does the '0x' just stand for 'this is hex'? Also... Lets say we have a number '010'...this is octel. Is putting a '0' in front of a number the only way to signify that a number is octel? Thanks! Dave

19. To Hex String and back...    coderanch.com

I'm in the middle of a muddle.... I'm trying to create a small class that will give me tools to convert a String to a string of hex numbers, then take that string of hex numbers and return to a normal string. Here's my code: public class Converters { public static String byteToHex (byte b) { // Returns hex String representation ...

20. Write hex code    coderanch.com

I have some hexadecimal values with me, like U+0103 U+0105 U+220B U+22F4 etc. Please tell me how can I write these characters in MS word or wordpad. To write ASCII character, I can use say, Alt+0+97 and "a" will be written. But how to write the values of these characters using the hex code.

21. Hex ??    coderanch.com

I want to take a byte array that has E3 8C A1 D9 20 C4 B8 B8 D3 94 6B 2C 72 F0 16 80 in it. And print out the string E38CA1D920C4B8B8D3946B2C72F01680 I was thinking to use the constructor String( byte[] ). But that isn't really working. for( int i = 0 ; i < bytearray.length ; i++ ) { ...

22. creating an image from a hex string Java 6    coderanch.com

Hi I would like to know how to create an image from a passed hex string. I have a legacy swf that puts out something like this FFFFFFF,FFFFFF,FFFFFF,.............etc My web app grabs this info along with the fileType(ie JPG GIF) and width and height data ready to be processed by Java. I have looked at java.awt.image.MemoryImageSource but am not to sure ...

23. Hex literals    coderanch.com

Just had a small "doh" moment, and thought I would write it here so it perhaps helps people avoid the same mistake In a program, I want to play around with bits and stuff. So, naturally I prefer hex notation. I initialized a variable like this: long value = 0xf0f0f0f0; Knowing that the variable is big enough to hold that value. ...

24. how to get rid of auto hex numerals display    coderanch.com

Hi all, I have a java table that gets/saves data from/to a sql table. The field in the database is set to: float (type), 15 (length) && 3 precision. Whenever I enter a value 9 000 000 or under it shows me the value I typed and the value saved in the database is correct but as soon as its greater ...

25. how to compare md5 hex with string    coderanch.com

26. Hex To Octal    java-forums.org

I am currently making a program that converts a hexadecimal number to an octal number. I have it so it can recognize letters out of the sequence, but what would be the best way of getting it to identify an int out of the sequence of letters and numbers? example of Hex: A5F6C example of Octal: 07453 I was thinking an ...

27. how to check hex range    forums.oracle.com

28. Hex Editor    forums.oracle.com

29. Doubt on Hex literals    forums.oracle.com

30. Hex to String    forums.oracle.com

uncle_alice wrote: This technique is never going to get the uptake it deserves until it's built into the Matcher API. I wonder if it's too late to get it into JDK 7? I have just spent 5 minutes looking at how Rewriter could be added to the regex package. I see two obvious approaches 1) A direct copy of Elliott's code ...

31. Java Hex?    forums.oracle.com

Hello, I was hoping someone could help answer what is probably a simple Java question or grand entry for dumbest question of the year, but here goes. Someone has given me a snippet of code and I am trying to figure out what I am looking at CAFEBABE 0003002D 00570100 08436166 65426162 65070001 0100106A 6176612F 6C616E67 ...and so on... Can someone ...

32. hex notation    forums.oracle.com

"$0F (Pronounced "OH EFF" or "ZERO EFF"). Note the use of the $ to show hex. You'll also see a hex number like this: 0x0F; In fact, the '0x' in front of a hex number is more current than the '$'. The '$' is sort of old school. Whether you use a '$' or a '0x', it tells you that you're ...

33. Problem with incrementing Hex from string    forums.oracle.com

ok, i tested it out and it is indeed length problem. Long still too short and Double I wasnt sure how to get it to work. I guess i need to split the hex apart, increment one of them and check if it overflowed onto the second part? like 12345FFFFFF - > if i split into 12345, FFFFFF and increment FFFFFF ...

34. Reading Hex data- how to typecast from string    forums.oracle.com

Hi, I am reading a file having hex data ( say 100 lines).When i read it i think it is being read as a string. How can i typecast or convert it to int . I am using dis.readLine() to read from file and assigning it to a variable(int). Thanks. Edited by: Motorcycle on Jun 10, 2009 3:16 PM

35. hex    forums.oracle.com

i have a device and i am creating a program that does the following:- i input a number, and int a will be assigned that particular number. example: i key in 55, then a = 55. however, here is the catch when i input 55, the device will output 0x0000037. it is in hex form. can java to read hex formats? ...

36. DecimalFormat in Hex    forums.oracle.com

37. Hex Code Matching    forums.oracle.com

hi ! I am taking the hex code of a file and then I match the hex code of the file with a string. There is a problem in matching. I have used a function that returns true if match is found. The string that I want to match is : 8B5604B1F0224E060AC1B43DCD21. I have tried using other strings and for those ...

38. HEX    forums.oracle.com

0x000 is a way to express hexidecimal numbers, which is not specific to Java. & is the bitwise AND operator. Since f0 in hex is 11110000, applying that to a number with AND basically just zero's out the last 4 bits of the number. I've never done bit-shifting in Java, but I would assume the >>> there is the bitshift operator, ...

39. Hex Code Generation Problem    forums.oracle.com

I doubt that the conversion is slow, but have no trouble believing that the reading from the large file can appear slow. You're doing the file read operations in a background thread, correct (or I'm thinking probably not)? If not, then this is what you must do, especially if you are working with GUI code -- never tie up the EDT. ...

40. Hex game making with java, NEED HELP!!    forums.oracle.com

public GamePiece neighbor(Nut gp, int direction) { int x = gp.getXCoordinate(); int y = gp.getYCoordinate(); switch (direction) { case 0: return getPiece(x, y-1); // above case 1: return getPiece(x+1, y-1); // upper right case 2: return getPiece(x+1, y); // lower right case 3: return getPiece(x, y+1); // below case 4: return getPiece(x-1, y+1); // lower left case 5: return getPiece(x-1, y); ...

41. String to MD5 hex    forums.oracle.com

hi all, i need a way to convert a String to an MD5, to be more precise i need to get the MD5 string in hex. I have tried a few methods but they only seem to work 80% of the time, any help would be appriciated. note: i am storing values in a mysql db (just a test will try ...

42. Hex editor needed    forums.oracle.com

Well, String.charAt() should provide you with the ASCII values (actually UNICODE character values, of which ASCII is a subset). I don't know what you mean by hex values. String.toBytes() will give you a byte array that might contain the information you want (if you want the hex values of the bytes the JVM uses to store Strings (in UTF-16 format, if ...

43. hex    forums.oracle.com

44. Reading numbers in hex    forums.oracle.com

I'm not sure if there is a way to convert from hex to binary directly (you could write it yourself if there isn't) but there is a two step way. Do as I said before and convert the hex string to an int and then convert the int to binary string. There is a method in the Integer class to do ...

45. Printing in hex.    forums.oracle.com

46. Trying to split up long hex string    forums.oracle.com

Hi, I am just starting a project which will require splitting up of a long hex string into packets which range from 1 byte to 6 bytes which will then be stored in different locations. Could anyone give me any pointers on where to look to acheive this. I was thinking about using a factory method, but I don't know how ...

47. hex editing    forums.oracle.com

48. Hex to EBCDIC    forums.oracle.com