Try using println statements to see the value of the variables in various places to see what is taking place as the code runs.
You say the method always returns 0. Think about that as you check the...