Here the code for get three digit value 'n' and calculate r=2^n+1 then find that value 'r' is a prie or not, here i like store the integer value 'r' without exponential function and big Integer, please make a great help to me.

thanks in advance..

import java.*;

import java.io.*;

import java.io.IOException.*;

import java.math.*;

public class primenumber extends power{

public static void main(String a[])throws IOException {

//get input

power ob=new power();

DataInputStream dis=new DataInputStream(System.in);

System.out.println(" Enter three digit number n:");

String nu=dis.readLine();

int n=Integer.parseInt(nu);

long nvalue=ob.powerr(n);

//find prime

long r;

int primevalue=0,i,j=0;

long factors[]=new long[100];

for(i=2;i<=nvalue;i++)

{r=nvalue%i;

if(r==0)

{

if(i!=nvalue)

{factors[j]=i;

j++;

primevalue=1;

//System.out.println("not prime");

}//inner if

else

{

//System.out.println("prime");

}

}//outer if

}//for ends

System.out.println("Given number is"+n+"");

System.out.println("Prime calculation for"+nvalue+"");

System.out.println("power value is"+nvalue+"");

if(primevalue!=1){

System.out.println("The number "+nvalue+" is prime");

}

else{

System.out.println("The number "+nvalue+" is not a prime");

System.out.println("factors");

for(int k=0;k<=j-1;k++)

System.out.print("," +factors[k]);

}//primevalueif

}//main end here

}//class end here

class power {

//find power

final int two=2;

long powvalue=1 , i;

long powerr(int x){

int n=x;

for(i=1;i<=n+1;i++)

{powvalue*=two;

}

return powvalue;

};

}