aspose file tools*
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
Author

BigInteger(String val, int radix) not working?

Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hello
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
author
Sheriff

Joined: Sep 28, 2004
Posts: 18824
    
  40

Try...

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

Henry


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?