Package net.n1da.dev.euler
Class PE0008
- java.lang.Object
-
- net.n1da.dev.euler.core.Problem
-
- net.n1da.dev.euler.PE0008
-
- All Implemented Interfaces:
Solvable
public class PE0008 extends Problem
Solution for problem 8 "Largest product in a series" completed on Fri, 10 Apr 2015, 09:07.- Since:
- 09.04.2015 23:42:06
- Author:
- Nico Danneberg
- See Also:
- Problem @ Project Euler, Solution @ Ni-Da-Net
-
-
Method Summary
Modifier and Type Method Description void
prepare()
Prepares the solving process by setting the wanted window size (13), initializing the storages and reading the 1000 digits from a file.private void
resetStorages()
java.lang.String
solve()
Solves this problem by running over every of the 1000 digits and multiplying it into theproducts
array.-
Methods inherited from class net.n1da.dev.euler.core.Problem
finish, getResult, getRuntime, toString
-
-
-
-
Method Detail
-
prepare
public void prepare()
Prepares the solving process by setting the wanted window size (13), initializing the storages and reading the 1000 digits from a file.- Specified by:
prepare
in interfaceSolvable
- Overrides:
prepare
in classProblem
- See Also:
IO.readDigits(String, int)
-
solve
public java.lang.String solve()
Solves this problem by running over every of the 1000 digits and multiplying it into theproducts
array. If thecounts
array at the same place is incremented and equal to thewindow
size, a candidate to the maximum is found. If a zero is found both local storages arereseted
.- Returns:
- the largest product of adjacent digits
- See Also:
resetStorages()
-
resetStorages
private void resetStorages()
-
-