Your code calculates the sum of the even Fibonacci numbers
in the first N Fibonacci numbers. This is not the same as calculating the sum of the even Fibonacci numbers
smaller than N.
The 400,000
th Fibonacci number is approximately 10
83,590. This is larger than any built-in type in Java (or any other language I'm aware of).
Check the condition of your loop; it should be something like:
while (b < n)
{
…
}