How to write power of something in java

i want to write 2^i so how to write this line java

Use Math.pow(2,i) for 2^i

add
import java.lang.Math;
to import the java.langpackage

Please mark your doubt as resolved if u are satisfied with the answer.