@@ -0,0 +1,564 @@
+import java.util.ArrayList;%0A%0Apublic class largest_prime_factor %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09System.out.println(getLargestPrime(600851475143L));%0A%09%7D%0A%0A%09public static long getLargestPrime(long input) %7B%0A%09%09long newVal=input;%0A%09%09ArrayList%3CLong%3E primes = new ArrayList%3CLong%3E();%0A%09%09for (long i=2; i%3CnewVal+1; i++) %7B%0A%09%09%09if (newVal %25 i == 0) %7B%0A%09%09%09%09newVal /= i;%0A%09%09%09%09primes.add(new Long(i));%0A%09%09%09%09i--;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09long highest = 0;%0A%09%09for (Long prime : primes) %7B%0A%09%09%09if (prime.longValue() %3E highest) %7B%0A%09%09%09%09highest = prime.longValue();%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return highest;%0A%09%7D%0A%7D

largest prime factor: java