Is it a Perfect Cube?

Can the parameter value be expressed as the cube of an integer?

Overview

Perfect cubes are integers which are the result of some integer raised to the $3^\text{rd}$ power. For example, $1 = 1^3$, $8 = 2^3$, $27 = 3^3$, $64 = 4^3$, etc. Thus, $1, 8, 27, 64, \ldots$ are perfect cubes.

Your task is to complete the implementation of a method that takes a long input parameter, and returns the boolean value true if the value of the parameter is a perfect cube, and false otherwise.

Implementation

Declaration

In the edu.cnm.deepdive.Cube class, the isPerfectCube method is declared with the following signature, return type, and modifiers:

public static boolean isPerfectCube(long input)

The implementation must not change the modifiers, return type, method name, parameter types/number/order, or possible exceptions shown above. For more method declaration details, see the Javadoc documentation.

Specifications

Tips

Unit tests

Your implementation will be verified using the following inputs and expected outputs.

input Expected return value of Cube.isPerfectCube(input)
0 true
-1 true
4_096 true
549_755_813_888L true
-1_152_924_803_144_876_033L true
9_223_358_842_721_533_951L true
4 false
65_536 false
549_755_813_889L false
-1_152_924_803_144_876_032L false
9_223_358_842_721_533_952L false