bit « Integer « Java Data Type Q&A





1. Is a Java int always 32 bits?    stackoverflow.com

Will Java's int always and everywhere be a 32 bit signed integer?

2. Java: Implementing a Unsigned 128bit Integer    stackoverflow.com

** first off I should ask: **
Does anyone knows of a current implementation 126b UINT for Java ? I need something to hold natural cardinal values. ie: A huge counter.

3. int datatype in 64bit JVM. Is it more "inefficient" than long?    stackoverflow.com

I heard that using shorts on 32bit system is just more inefficient than using ints. Is this the same for ints on a 64bit system? Python recently(?) basically merged ints ...

4. Storing int value of bitmask - extract 1 valued bits    stackoverflow.com

I am calculating the int equivalent of a given set of bits and storing that in memory. From there, I would like to determine all 1 value bits from the original ...

5. Signed und Unsigned Integers in Preon    stackoverflow.com

I want to use Preon for project that communicates with a server written in C. The protocol depends on the native endianess of the machine (you can solve with ...

6. How do I declare a 32bit integer in java?    stackoverflow.com

I'm looking at an app in java that runs on both 32bit and 64bit systems, and it deals mainly with IP addresses. These IP addresses are kept as integers, and ...

7. IEEE-754 Double (64-bit floating point) vs. Long (64-bit Integer) Revisited    stackoverflow.com

I'm revisiting a question (How to test if numeric conversion will change value?) that as far as I was concerned was fully solved. The problem was to detect when a ...

8. need a method to return the value of a specific bit of an int    stackoverflow.com

I think I need a utility method like this:

public static short bitValue(int intNum, short pos)
{
    short bitValue = 0;

    //check pos bit (from right to ...

9. retrieve value stored in certain bits of an int    stackoverflow.com

We divided an int to save three values into it. For example the first 8 bits (from left to right) hold one value, the 8th to 12th bits hold another value ...





10. "Simulating" a 64-bit integer with two 32-bit integers    stackoverflow.com

I'm writing a very computationally intense procedure for a mobile device and I'm limited to 32-bit CPUs. In essence, I'm performing dot products of huge sets of data (>12k signed 16-bit ...

11. Is there difference for Integer.MAX_VALUE between 32bit JVM and 64bit JVM?    stackoverflow.com

Is the value of Integer.MAX_VALUE different between 32bit JVMs and 64bit JVMs? I am compiling a Java class using 32bit JDK and deploy it on a 64bit machine. I just want to ...

12. bit manipulation using int in java    stackoverflow.com

I have an int and I want to invert the bits of it using the ~ bit operator. This should be a very simply thing to do, however I tried and ...

13. unsigned 8 bit integers,, and checksums    coderanch.com

1) how would I represent unsigned 8 bit integers in Java? Can I do this using a type or should I use byte, write out the value in unsigned 8 bit binary, and then reverse out the 2's complement to get the value? As an example 16 decimal = 0001 0000 and that works fine as it's not a 2's complement ...

14. integer bit values    coderanch.com

I'm having some trouble with some pretty basic stuff, and I was hoping someone could give me a hand. I need to write a program that asks the user to enter an integer and bit position. The program then needs to write out the value of the bit in that position of the integer (1 or 0). I know this sounds ...

15. bit values of an integer    coderanch.com

I'm having some trouble with some pretty basic stuff, and I was hoping someone could give me a hand. I need to write a program that asks the user to enter an integer and bit position. The program then needs to write out the value of the bit in that position of the integer (1 or 0). I know this sounds ...

16. Addition of 256bit unsigned integers    coderanch.com





17. Generate bits out of int?    coderanch.com

Thanks for reply. Following is my algorithm- (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) = 8 + 0 + 2 + 1 = 11 Yes, it is basics and I believe I learnt in 5th grade . I know on a piece of paper, I can calculate. 1 0 1 1 But in ...

18. Integer.toBinaryString() - 4 bits every time    forums.oracle.com

I am using the Integer.toBinaryString() method to convert ints between 1 and 14 into binary.I would like them to be 4 bits long every time, i.e 2 = 0010. At the moment a 2 would be represented as 10. I need them as 4 bits because i will be concatenating 6 of these binary strings together, and losing length will completely ...

19. Reproduce Integer from Bits    forums.oracle.com

What's the format of the bits? If it's binary bits (not encoded) then put the bits in a string and use Integer.parseInt. If the bits are encoded, then you'll need to interpret the bits - Java can interpret IEE754 formats using Double.longBitsToDouble. I don't believe any other encodings are provided by standard Java.

20. Float.intBitsToFloat(int bits) question about endianess    forums.oracle.com

terps128 wrote: I am confused about how Float.intBitsToFloat() works. If I give it say 123, will it look at 1 as the most significant digit or 3? The most significant digit is always the one that has the highest influence on the value. In the (decimal) number 123 the most significant digit is 1, because changing it to anything else changes ...

21. 128-bit int and 128-bit double.    forums.oracle.com

jschell wrote: Just a suggestion but you might find it reasonable for that problem domain to do it yourself. Certainly a lot of work but possible. You would probably see it sooner than with the RFE. Probably help the RFE along to see how feasible it is. Imagine 128-bit long to be easier to implement first. Actually this would be the ...

22. bit manipulation - converting int value to 4 bits    forums.oracle.com

Is there someway of converting int values to a set number of bits without affecting the other bits in the byte. If I have a byte and I the first 3 bits are reserved and the other 5 bits represent a number. So I need convert a number to the 5 bits without changing the values in the first 3 bits. ...

23. reading 16 bit ints    forums.oracle.com

24. Create a numeric (32-bit integer) digest from string?    forums.oracle.com

I want to create a unique hashcode/digest integer value (32-bit integer). Input data is strings. Possible input values are "123", "131", "131_a", "131_b", "144_12_a", "144_12_b", ... Requirements: * digest/whatever method should return an integer * Same input should give the same integer in all JVMs (jdk1.1, jdk1.6, jdk1.7, ...) at any time * No collisions I was first about to use ...

25. int bits, represent -(2^31)?    forums.oracle.com

26. Converting Integer to an 8 bit representation    forums.oracle.com

I understand that the character range is 0-255 I want to create new charaters like "ab" which i would give a value of 256. I want to output the value 256 to a .dat file using DataOutputStream. However the character that is outputted to the .dat file has a value of 1 instead of 256. So i think the 256 value ...

27. Bit Packing (Bytes into Int)    forums.oracle.com