# biginteger

Printable View

• April 1st, 2014, 09:19 AM
subhradeep
biginteger
how can i store biginteger in an array?
• April 1st, 2014, 09:33 AM
copeg
Re: biginteger
Quote:

Originally Posted by subhradeep
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.
• April 1st, 2014, 09:47 PM
subhradeep
Re: biginteger
but Array can't store biginteger value
• April 1st, 2014, 09:58 PM
dicdic
Re: biginteger
Quote:

Originally Posted by subhradeep
but Array can't store biginteger value

Actually it can.
Just think on how to declare an int array, String array, char array. Then you'll realize how to declare a BigInteger array
• April 1st, 2014, 10:08 PM
subhradeep
Re: biginteger
just like this:
biginteger[] anArrayOfBigintegers;
• April 1st, 2014, 10:10 PM
dicdic
Re: biginteger
Quote:

Originally Posted by subhradeep
just like this:
biginteger[] anArrayOfBigintegers;

yeah you got it.
• April 1st, 2014, 10:22 PM
subhradeep
Re: biginteger
thanks sir
• April 2nd, 2014, 10:44 AM
subhradeep
Re: biginteger
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..
• April 2nd, 2014, 10:54 AM
Norm
Re: biginteger
Try defining an array of BigIntegers with a size and then assigning to each element in the array an instance of BigInteger.
• April 2nd, 2014, 12:09 PM
subhradeep
Re: biginteger
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
• April 2nd, 2014, 12:35 PM
Norm
Re: biginteger
Quote:

fail to create biginteger array
Please explain what the problem is.
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.
• April 2nd, 2014, 12:38 PM
copeg
Re: biginteger
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

Code :

```import java.math.BigInteger; ... biginteger number[]=new biginteger[2];```

Java is case sensitive.
• April 2nd, 2014, 12:44 PM
subhradeep
Re: biginteger
Code java:

```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]); } } }```

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
• April 2nd, 2014, 12:49 PM
Norm
Re: biginteger
Reread the last line in post#12

Or define your own class named: biginteger that takes an int value in its constructor.
• April 2nd, 2014, 09:29 PM
subhradeep
Re: biginteger
please give an complete example...
• April 3rd, 2014, 07:59 AM
Norm
Re: biginteger
You used the correct spelling in the import statement:
import java.math.BigInteger;
• April 3rd, 2014, 09:40 AM
subhradeep
Re: biginteger
what is my mistake?I use the correct spelling...
• April 3rd, 2014, 09:49 AM
Norm
Re: biginteger
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'?
• April 3rd, 2014, 12:23 PM
copeg
Re: biginteger
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