how can i store biginteger in an array?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
how can i store biginteger in an array?
Create an array of type BigInteger, and set each index of the array as appropriate. Suggested reading:
Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
If that doesn't address your question, please be a lot more specific.
but Array can't store biginteger value
just like this:
biginteger[] anArrayOfBigintegers;
thanks sir
import java.math.BigInteger;
public class Array
{
public static void main(String sr[])
{
biginteger arr[]={55,15,2,3};
for(int i=0;i<4;i++)
{
System.out.println("list"+arr[i]);
}
}
}
I can't implement any biginteger array..please help me..
Try defining an array of BigIntegers with a size and then assigning to each element in the array an instance of BigInteger.
If you don't understand my answer, don't ignore it, ask a question.
import java.math.BigInteger;
public class Array
{
public static void main(String sr[])
{
biginteger number[]=new biginteger[2];
number[0]=new biginteger[3];
number[1]=new biginteger[2];
for(int i=0;i<2;i++)
{
System.out.println("ARRAY"+number[i]);
}
}
}
Sorry.. Again I fail to create biginteger array..have any another idea?please send me a correct biginteger array code
Last edited by subhradeep; April 2nd, 2014 at 11:34 AM.
Please explain what the problem is.fail to create biginteger array
If there are error messages, copy the full text of the messages and paste it here.
Be sure to wrap your code with code tags:
[code=java]
YOUR CODE HERE
[/code]
to get highlighting and preserve formatting.
If you don't understand my answer, don't ignore it, ask a question.
For future reference, please be explicit when explaining your problem. If you post code, state whether it compiles or define any exceptions and post the full error messages. Further, please wrap all code in the code tags
import java.math.BigInteger; ... biginteger number[]=new biginteger[2];
Java is case sensitive.
C:\Java\jdk1.5.0\bin>javac Array.java
Array.java:7: cannot find symbol
symbol : class biginteger
location: class Array
biginteger number[]=new biginteger[2];
^
Array.java:7: cannot find symbol
symbol : class biginteger
location: class Array
biginteger number[]=new biginteger[2];
^
Array.java:8: cannot find symbol
symbol : class biginteger
location: class Array
number[0]=new biginteger[3];
^
Array.java:9: cannot find symbol
symbol : class biginteger
location: class Array
number[1]=new biginteger[2];
^
4 errors
Reread the last line in post#12
Or define your own class named: biginteger that takes an int value in its constructor.
If you don't understand my answer, don't ignore it, ask a question.
please give an complete example...
You used the correct spelling in the import statement:
import java.math.BigInteger;
If you don't understand my answer, don't ignore it, ask a question.
what is my mistake?I use the correct spelling...
Yes the spelling in the import statement is correct.
The compiler can not find the definition for the biginteger class.
Where is that class defined?
Do you understand that 'b' is not the same as 'B'?
If you don't understand my answer, don't ignore it, ask a question.
My .02: if you are having this hard of a time with basic language syntax, I would recommend taking a step back - ignore the BigInteger class for the moment and take some time to learn some of the essential basics of the language:
The Java™ Tutorials