If you look at the documentation , it says that Math.pow() expects two doubles and returns double.When you pass ints to this function, it means no harm, because casting (converting) int to double means no loss. But when you assign an int value, it means that it may lose precision.
Just do the following:
int x = (int)Math.pow (2,4);
or
double x = Math.pow (2,4);
source share