Prove that $n$ is a sum of two squares?
I was reading this and began wondering if there is a general theorem that a number of a given form is the sum of two squares. I know about Fermat's Theorem, but I am thinking about the general case. The question is
For which positive integer $n$ we can find positive integers $a,b$ with $n=a^2+b^2$?
I found a related question: Prove that $n$ is a sum of two squares?
If this is a duplicate, I am sorry. I have searched the site and didn't find this question posted. Any reference would be useful.