jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes BigInteger(String val, int radix) not working? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "BigInteger(String val, int radix) not working?" Watch "BigInteger(String val, int radix) not working?" New topic

BigInteger(String val, int radix) not working?

Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
I am sure it is, but not for me. The method below claims it cant find the method and of course I have imported java.math.BigInteger.

public byte[] getNum() {
String str="123";
BigInteger bi= BigInteger(str.toString(), 10);
return bi.toByteArray();

I cant see anything wrong with this? What is? tia.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Missing "new"

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Henry Wong

Joined: Sep 28, 2004
Posts: 20134


BigInteger bi= new BigInteger(str.toString(), 10);


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780

Note the *new* :roll:

There is no emoticon for what I am feeling!
I agree. Here's the link: http://aspose.com/file-tools
subject: BigInteger(String val, int radix) not working?
It's not a secret anymore!