public static int searchInsert(int[] nums, int target) { int sta = 0,fin = nums.length,mid; while (sta < fin) { mid = (sta + fin )/2; if(nums[mid] < target) sta = mid +1; else fin = mid; } return sta; }