Here you can find the source of isPerfectCubic(BigInteger n)
public static boolean isPerfectCubic(BigInteger n)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; import java.util.HashMap; import java.util.Map; public class Main { private static Map<BigInteger, Long> cubicCache = new HashMap<BigInteger, Long>(); private static BigInteger maxCubicInCache = BigInteger.ZERO; public static boolean isPerfectCubic(BigInteger n) { while (maxCubicInCache.compareTo(n) < 0) { Long v = cubicCache.get(maxCubicInCache); ++v;//from ww w. j av a 2 s .c o m BigInteger vb = BigInteger.valueOf(v); BigInteger k = vb.multiply(vb).multiply(vb); cubicCache.put(k, v); maxCubicInCache = k; } return cubicCache.containsKey(n); } }