like wise how to convert BigInteger bi = new
BigInteger("4444444444444444444444444444");
How to convert bi to hex.
Regards
Nanaji
Try:
bi.toString(16)
Arne
Regards
Nanaji
Im sure you can pass a hex String into the constructor of BigInteger as
well. BigInteger bi = new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFF",16);
Will the BigInteger Class go to any base ?
j1mb0jay.
Arne Vajhøj wrote:
>> bi.toString(16)
Nanaji wrote:
> Thanks, it works.
You should always look at the Javadocs first:
<http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html>
If you don't use the Javadocs (onscreen or memorized) for matters of the
standard API then you aren't really a Java programmer.
--
Lew
Arne Vajhøj wrote:
>> Try:
>>
>> bi.toString(16)
j1mb0jay wrote:
> Im sure you can pass a hex String into the constructor of BigInteger as
> well. BigInteger bi = new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFF",16);
>
> Will the BigInteger Class go to any base ?
You should always look at the Javadocs first:
<http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#toString(int)>
<http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#BigInteger(java.lang.String,%20int)>
Memorized? I wish I had that kind of memory retention :-)
--
Wojtek :-)
That is the opposite direction.
Java Docs say:
Throws:
NumberFormatException - val is not a valid representation of a
BigInteger in the specified radix, or radix is outside the range from
Character.MIN_RADIX to Character.MAX_RADIX, inclusive.
which at least on my system means 2..36 !
Arne
I don't think any programmer has memorized it all ...
Arne
Arne Vajh??j wrote:
>> bi.toString(16)
Nanaji wrote:
> Thanks, it works.
You should therefore look at the Javadocs first:
If you don't possess the Javadocs (onscreen or learned) for matters of the
standard API then you aren't presently a Java killer.
--
Lew
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Sometimes the truth is so precious
it must be accompanied by a bodyguard of lies."
--- Offense Secretary Donald Rumsfeld
Wow, you guys are so serious. I would not be surprised if there were one.
I just didn't want to insist that people use onscreen (or printed) Javadocs
and have someone object on the grounds that they had it memorized.
(And now Almond will do his oh-so-not-clever rewrite of my messages.)
--
Lew