binary « bit « Java Data Type Q&A





1. (Java) Specify number of bits (length) when converting binary number to string?    stackoverflow.com

I'm trying to store a number as a binary string in an array but I need to specify how many bits to store it as. For example, if I need to store ...

2. How best to search binary data for variable length bit strings?    stackoverflow.com

Can anyone tell me the best way to decode binary data with variable length bit strings in java? For example:

The binary data is 10101000 11100010 01100001 01010111 01110001 01010110 ...

3. Removing lowest order bit    stackoverflow.com

Given a binary number, what is the fastest way of removing the lowest order bit? 01001001010 -> 01001001000 It would be used in code to iterate over the bits of a variable. ...

4. Generate a random binary number with a variable proportion of '1' bits    stackoverflow.com

I need a function to generate random integers. (assume Java long type for now, but this will be extended to BigInteger or BitSet later.) The tricky part is there is a parameter ...

5. Create DES key from 56 bit binary string    stackoverflow.com

I have a 56 bit binary string that i want to use as the secret key for DES encryption. I found the following code at the JCA docs website

byte[] desKeyData = ...

6. Inference Engine implementation in java    stackoverflow.com

I am trying to think of an algorithm where I can create number of possible binary combinations for my inference engine implementation in short if input file to my program has 4 ...

7. 16 bit binary leading zeros    stackoverflow.com

I am using toBinaryString translation method like this:

for (i=0; i<anyLines.length; i++) {

            if (anyLines[i].startsWith("@")) {
      ...

8. Change Value of First Bit in Binary String - Java    stackoverflow.com

I have a program which works with genetic algorithms and generates an 8-bit binary string (chromosome consisting of eight genes). I would like to know how I would go about changing / ...

9. What does this java method do with bitwise operations?    stackoverflow.com

Im not familiar with bitwise operations. This is an image manipulation algorithm. What is happening?

void binarize50(int pixels[]) {
        for(int i = 0; i < ...





10. Constructing a sequence of bits in java    stackoverflow.com

I'm having trouble getting a bit to work properly in java6...I'm trying to write a compression program that will write bits to a compressed file...so for example a common letter such ...

11. Binary - Bit level Operations    coderanch.com

Hi I have the following requirement: I have to find the position of the higher order bit for a given number. I am achiving it by the following method. for (int key = 0; key<32; key++) { result = ((given_number & 0x80000000) == 0) ? 0 : 1; system.out.println(result); given_number<<=1; } This works fine when the given_value is of type int. ...

12. Image to Binary bits    java-forums.org

I think you would have to create a PixelGrabber which returns an array of ints made from the image. Once you have that, I think you could use this method to convert the ints to binary: Integer.toBinaryString(int); Here is an example of a Pixel Grabber that creates a screen shot and throws it into an array of ints. private int[] capture() ...

13. How best to search binary data for specific bit strings?    forums.oracle.com

That looks promising Endasil, thanks. I need to get some sleep now but I'll check it out later. One thing though that I should have made clear in my original post is that the bit strings have variable lengths, so they are not necessarily one byte long. In fact they are anything from 2 to 16 bits long. So I'm not ...

14. converting 8-bit encoded binary data to 7-bit encoded data & vice versa    forums.oracle.com

hello, i am receiving SMS via GSM modem, the PDU here is in 8-bit binary encoded format, however i am storing the data in a smpp server, so i need to convert this into 7-bit binary encoded, has anyone done this before, if so could someone send a java code/snippet which does this conversion and vice versa.