Update Occurence of a key in sorted array.java