how to find equilibrium index of an array in java