Educating myself on java8, this is a not-even-close-to-optimal prime-number detection algorithm