Here is a video [1] and associated java source code [2] from pi day in 2018 to generate 1M (or more) digits of pi using the same Gauss-Legendre algorithm.
[1] https://www.youtube.com/watch?v=8RONJPOgZjw
[2] https://github.com/R-e-t-u-r-n-N-u-l-l/Java-Algorithms/blob/...