I've managed to make my code working, but feel like there's a better approach to writing similar stuff, any tips or mistakes to point out?
Here's my code:
public static void main(String[] args) {
DecimalFormat df = new DecimalFormat("0.##E0");
BigDecimal a;
BigInteger fact;
int n=10;
int x=3;
for (int i=1; i<=n; i++){
fact=BigInteger.valueOf(1);
for (int j=1; j<=Math.pow(i,2)+1; j++){
fact=fact.multiply(BigInteger.valueOf(j));
}
a=BigDecimal.valueOf((Math.pow(-1, i+1)*Math.log(i*x))/i).divide(new BigDecimal(fact), 500, BigDecimal.ROUND_HALF_EVEN);
System.out.println(df.format(a));
}
}