File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 20535


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:
subject: BigInteger(String val, int radix) not working?
It's not a secret anymore!