16 lines
496 B
Text
16 lines
496 B
Text
import java.math.BigInteger;
|
|
|
|
// Variable definitions
|
|
BigInteger _5, _4, powResult;
|
|
_5 = BigInteger.valueOf(5);
|
|
_4 = BigInteger.valueOf(4);
|
|
|
|
//calculations
|
|
powResult = _5.pow(_4.pow(9).intValueExact());
|
|
String powStr = powResult.toString();
|
|
int powLen = powStr.length();
|
|
String powStrStart = powStr.substring(0, 20);
|
|
String powStrEnd = powStr.substring(powLen - 20);
|
|
|
|
//output
|
|
System.out.printf("5**4**3**2 = %s...%s and has %d digits%n", powStrStart, powStrEnd, powLen);
|