like
BigInteger n=new BigInteger(jTextField1.getText());
then all prime number less then n.
While I tried it was giving error the increment and comparison operator can not be applied to BigInt..
Expand|Select|Wrap|Line Numbers
- for (i=1;i<n; n.add(BigInteger.ONE)) // Error : -- and >= can not be applied to java.math.BigInteger
- {
- int ctr=0;
- for(x =i; x>=1; x--) // Error : -- and >= can not be applied to java.math.BigInteger
- {
- if(i%x==0) //Error : % can not be applied to java.math.BigInteger
- {
- ctr = ctr + 1;
- }
- }
- if (ctr ==2)
- {
- System.out.print(" " + i);
- }
- }