Refactored calculateNextPrime() and created a new method  updateSquaredPrime().

This makes the algorithm clearer.
Created a new method isTestNumberPrime ()  using the while loop in calculateNextPrime().

This will make the algorithm more readable.