Pergunta de entrevista da empresa Fidelity Investments

Write a Java function that prints all the prime numbers up to a specified value and explain its time complexity.