• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BigInteger(String val, int radix) not working?

 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Missing "new"
 
Henry Wong
author
Marshal
Pie
Posts: 21190
80
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try...

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

Henry
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Note the *new* :roll:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic