Try to move your mid variable declaration out of your while loop. Instead of declaring it in every single loop, just changing its value will be better. A small but cute change I suppose.

public int searchInsert(int[] A, int target) { int low = 0, high = A.length-1, mid = 0; while(low<=high){ mid = (low+high)/2; if(A[mid] == target) return mid; else if(A[mid] > target) high = mid-1; else low = mid+1; } return low; }Search Insert Position