binary « decimal « Java Data Type Q&A

1. big binary number to decimal

Hello All, I have a requirement to convert a big binary number (as input to me in form of String) to a decimal number and then persist this decimal number in Number(38) data type column of oracle database table. Please suggest as which data type I should be using to hold this big decimal number and how to convert this binary ...

2. binary to decimal

Hi, The difference between the two ( perfectly possible ) interpretations lie in if the number is signed or positive. If it's signed then the most significant bit is considered to be negative and with 8 data bits (one byte )we would get a range from - 128 to + 127. If the number is unsigned then the the range is ...

3. Binary to decimal

3 bit value is---->11 for finding -3 value(flip+add 1) fliping gives----->1111 1111 1111 1111 1111 1111 1111 1111 1100 add 1 gives----> 1111 1111 1111 1111 1111 1111 1111 1111 1101(this is the result of -3 bit representation) But when i convert the previous bit representation back to decimal as 1*2^0+0*2^1+1*2^2--->-5 (why it is not giving -3 value) Then how come ...

4. Negative binary to decimal problem

I have an application that I am trying to convert a negative binary number to the negative decimal number. The method that I have below doing this is BTD. I can get the positive numbers to compute correctly but a negative binary number to negative decimal number I can not ? Any suggestions would be of great help !! Thank you!! ...

5. decimal to binary

What do you mean by a 'binary integer'? Java has an Integer class, and an int primitive. How the values are stored is not relevant to how they are displayed. So let's back up a little. What exactly do you have, and what exactly do you need to do? Can you provide some code samples to show us?

6. Decimal to Binary

7. Decimal to Binary

Hi all, I have this problem: Transform a Decimal to a Binary. So, i did this: ------------------------------------------------------------------------------------------------------------------------------------------------------------- public static void main(String[] args) throws IOException { int NumDec; int R; System.out.println("Decimal"); do { BufferedReader input = new BufferedReader ( new InputStreamReader (; String line = input.readLine(); NumDec = Integer.parseInt (line) ; } while((NumDec <= 0) || (NumDec != NumDec)); String NumBin = ...

8. Binary to Decimal

mTeigeler, I've just replied to three threads you also replied to and each time you posted a "solution" that only vaguely resembles something that might be related to the OPs actual question. What's with the byte array and the BigInteger? The OP has stated he has a String representing a 10 digit binary number...

9. More Binary to Decimal

Stopper is quite correct. You are missing the things Stopper noted. To trouble shoot such code use your compiler output or a decent IDE like Eclipse or JBuilder which will auto compile and highlight your errors quickly. You can clean up your method code by adding the variable defnition and initialization code mentioned at the beginning of the method.

10. Homework: Binary to Decimal

You don't actually look at c. You grab it, then ignore it. All you have to do is start using it. You could parse the character into a number, but since it's a single digit that's either 1 or 0, you could just as easily use an if/else statement. If it's 1, then take the exponent as you are. If it's ...

11. binary to decimal

12. Java binary to decimal?

13. binary number to decimal

Hi I realy need help with my java program because something is built wrong and is does not working properly. I attached my program: import java.util.Scanner; import java.lang.*; public class BinaryToDecimal { public static void main (String [] args) { String a; int b; double sum; Scanner reader=new Scanner(; System.out.println("Enter a binary String: \t"); String binary=reader.nextLine(); sum = 0; for (int ...

14. Decimal to Binary

15. Binary to decimal

16. Binary to decimal

17. binary numbers to decimal numbers