This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes big binary number to decimal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "big binary number to decimal" Watch "big binary number to decimal" New topic

big binary number to decimal

Viral Thakkar
Ranch Hand

Joined: Jan 30, 2001
Posts: 33
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 representation string data to decimal number.

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Look at the API for java.math.BigInteger.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Have you taken a look at the API about java.math.BigDecimal?
Viral Thakkar
Ranch Hand

Joined: Jan 30, 2001
Posts: 33


BigInteger bigInt = new BigInteger("100010001000100010001000100010011000011100010001000100010001000100010011000011111111111111111111111111111111111111111111111100",2);

BigDecimal bigDec = new BigDecimal(bigInt);

Then use this BigDecimal object to persist the data in Number type in oracle database table.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: big binary number to decimal
Similar Threads
negative numbers-2
Wrapper class Long.toString() method
Convert String to BigDecimal
Converting a String to the appropriate numeric data type...