Java See if a number can be square/cube rooted : <p>I would like to square/cube root but also 4,5,etc. how would I do this?<br>
I can do square</p>

<pre><code>public static boolean isSquareNumber(int n) {
    int a  = (int) Math.sqrt(n);
    if(Math.pow(a, 2) == n) {
        return true;
    } else {
        return false;
    }
}
</code></pre>

<p>How would I do this for other powers?</p>
