The Math.pow method returns your result as a double itself. You attempting to return the double as an int is what the lossy conversion is. You can use some casting to be able to still use Math.pow and have it return an int.
We haven't learned about Math.pow yet... so it's simpler to just use
i * i
which gives you back an int, which is what you want!