Hi, how can one find the number of ways in which an integer can be expressed as a sum of two squares?

E.g for 5 it's 1, as 5 can be represented as : 1^2+2^2.

Here a^a+b^b is same as b^b+a^a.

I know that for an integer to be expressed as such , its prime factorisation should contain no odd powers of primes of the form 4k+ 3 . So how do i extend this idea to arrive at the conclusion or is there any other way/formula?

Thanks.