Java version prime factor