GooseterV / Project-Euler

Undocumented method found JAVA-D1001
Documentation
Minor
20 occurrences in this check
Consider adding a doc comment for SieveOfEratosthenes
 9	static ArrayList<Integer> primes =
10	   new ArrayList<Integer>();
11	 
12	void SieveOfEratosthenes()13	{14		// Create a boolean array "IsPrime[0..MAX_SIZE]"15		// and initialize all entries it as true.16		// A value in IsPrime[i] will finally be false17		// if i is Not a IsPrime, else true.18		boolean [] IsPrime = new boolean[MAX_SIZE];19		 20		for(int i = 0; i < MAX_SIZE; i++)21			IsPrime[i] = true;22		 23		for (int p = 2; p * p < MAX_SIZE; p++)24		{25			// If IsPrime[p] is not changed,26			// then it is a prime27			if (IsPrime[p] == true)28			{29				// Update all multiples of p greater than or30				// equal to the square of it31				// numbers which are multiple of p and are32				// less than p^2 are already been marked.33				for (int i = p * p; i < MAX_SIZE; i += p)34					IsPrime[i] = false;35			}36		}37	 38		// Store all prime numbers39		for (int p = 2; p < MAX_SIZE; p++)40		if (IsPrime[p] == true)41				primes.add(p);42	}43	public int run() {
44		SieveOfEratosthenes();
45		return primes.get(10000);
Consider adding a doc comment for main
44		SieveOfEratosthenes();
45		return primes.get(10000);
46	}
47	public static void main (String[] args) {48		System.out.println(new p007().run());49	}50}
Consider adding a doc comment for run
40		if (IsPrime[p] == true)
41				primes.add(p);
42	}
43	public int run() {44		SieveOfEratosthenes();45		return primes.get(10000);46	}47	public static void main (String[] args) {
48		System.out.println(new p007().run());
49	}
Consider adding a doc comment for run
 1package javasec;
 2
 3public class p006 {
 4	public double run() { 5		int total = 0; 6		int total2 = 0; 7		for (int i = 1; i <= 100; i++) { 8			total += Math.pow(i, 2); 9			total2 += i;10		};11		return (Math.pow(total2, 2) - total);12	}13	public static void main(String[] args) {
14		System.out.println(new p006().run());
15	}
Consider adding a doc comment for main
10		};
11		return (Math.pow(total2, 2) - total);
12	}
13	public static void main(String[] args) {14		System.out.println(new p006().run());15	}16}
Consider adding a doc comment for gcd
 1package javasec;
 2
 3public class p005 {
 4	public int gcd(int a, int b) { 5		while (b != 0) { 6			int c = a % b; 7			a = b; 8			b = c; 9		}10		return a;11	}12	public int lcm(int a, int b) {
13		return a / gcd(a, b) * b;
14	}
Consider adding a doc comment for lcm
 9		}
10		return a;
11	}
12	public int lcm(int a, int b) {13		return a / gcd(a, b) * b;14	}15
16	public int run() {
17		int count = 1;
Consider adding a doc comment for run
13		return a / gcd(a, b) * b;
14	}
15
16	public int run() {17		int count = 1;18		for (int i = 1; i < 21; i++) {19			count *= (int)Math.floor(i / gcd(i, count));20		}21		return count;22	}23	public static void main(String[] args) {
24		System.out.println(new p005().run());
25	}
Consider adding a doc comment for main
20		}
21		return count;
22	}
23	public static void main(String[] args) {24		System.out.println(new p005().run());25	}26}
Consider adding a doc comment for main
25		}
26		return Collections.max(palendromes);
27	}
28	public static void main(String[] args) {29		System.out.println(new p004().compute());30	}31}
Consider adding a doc comment for compute
11	public Boolean isPalendromic(Integer n) {
12		return n.toString().equals(reverse(n.toString()));
13	}
14	public Integer compute() {15		ArrayList<Integer> palendromes = new ArrayList<Integer>();16		for (Integer i = 100; i < 1000; i++) {17			for (Integer j = 100; j < 1000; j++) {18				Integer k = i * j;19				if (isPalendromic(k)) {20					palendromes.add(k);21				}22				23			}24			25		}26		return Collections.max(palendromes);27	}28	public static void main(String[] args) {
29		System.out.println(new p004().compute());
30	}
Consider adding a doc comment for isPalendromic
 8	static String reverse(String str) {
 9		return new StringBuilder(str).reverse().toString();
10	}
11	public Boolean isPalendromic(Integer n) {12		return n.toString().equals(reverse(n.toString()));13	}14	public Integer compute() {
15		ArrayList<Integer> palendromes = new ArrayList<Integer>();
16		for (Integer i = 100; i < 1000; i++) {
Consider adding a doc comment for reverse
 5import java.lang.String;
 6
 7public final class p004 {
 8	static String reverse(String str) { 9		return new StringBuilder(str).reverse().toString();10	}11	public Boolean isPalendromic(Integer n) {
12		return n.toString().equals(reverse(n.toString()));
13	}
Consider adding a doc comment for main
19				return x;
20		}
21	}
22	public static void main(String[] args) {23		System.out.println(new p003().run());24	}25}
Consider adding a doc comment for run
 9		}
10		return x;  
11	}
12	public long run() {13		long x = 600851475143L;14		while (true) {15			long y = smallestFactor(x);16			if (y < x)17				x /= y;18			else19				return x;20		}21	}22	public static void main(String[] args) {
23		System.out.println(new p003().run());
24	}
Consider adding a doc comment for smallestFactor
 1package javasec;
 2
 3public class p003 {
 4	public long smallestFactor(long x) { 5		for (int i = 2; i <= Math.floor(Math.pow(x, 0.5f)); i++) { 6			if (x % i == 0) { 7				return i; 8			} 9		}10		return x;  11	}12	public long run() {
13		long x = 600851475143L;
14		while (true) {
Consider adding a doc comment for calculate
 4	public static void main(String[] args) {
 5		System.out.println(new p002().calculate());
 6	}
 7	public int calculate() { 8		int total = 0; 9		int a = 1;10		int b = 2;11		while (a <= 4000000) {12			if (a % 2 == 0) {13				total += a;14			}15			int c = a + b;16			a = b;17			b = c;18		}19		return total;20		21	}22}
23
24
Consider adding a doc comment for main
 1package javasec;
 2
 3public final class p002 {
 4	public static void main(String[] args) { 5		System.out.println(new p002().calculate()); 6	} 7	public int calculate() {
 8		int total = 0;
 9		int a = 1;
Consider adding a doc comment for main
 1package javasec;
 2
 3public final class p001 {
 4	public static void main(String[] args) { 5		System.out.println(new p001().calculate()); 6	} 7	public int calculate() {
 8		int total = 0;
 9		for (int i = 0; i < 1000; i++) {
Consider adding a doc comment for calculate
 4	public static void main(String[] args) {
 5		System.out.println(new p001().calculate());
 6	}
 7	public int calculate() { 8		int total = 0; 9		for (int i = 0; i < 1000; i++) {10			if (i % 3 == 0 || i % 5 == 0) {11				total += i;12			}13		}14		return total;15	}16}