MathContext RoundingMode BigDecimal
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
public class A {
public static String getPow(int n,int m){
MathContext mc=new MathContext(m,RoundingMode.HALF_UP);
BigDecimal b=new BigDecimal(n,mc);
return (b.pow(m)).toString();
}
public static void main(String[] args){
System.out.println(getPow(2,1000));
}
}