Java does not have an exponent operator like some other languages. Instead, you handle common mathematical operations in Java using the appropriately named Math static class in java.util.Math. Supported operations include those for finding the absolute value, common trigonometric functions, rounding and exponents. The results of these mathematical operations are nearly always "double" data-types, but you can cast them down to integers and floats.
Open the Netbeans Integrated Development Environment, or IDE, or your preferred Java editor.
Open an existing Java source file or create a new one by clicking "File" and "New Class."
Add the following line to the top of the document:
Type the following anywhere in the document to find an exponent:
double result = Math.pow(number, exponent);
Replace "number" with the base value and "exponent" with the exponent it is to be raised to. For example:
double result = Math.pow(4,2);
This results in 16, or 4^2.