public int[] searchRange(int[] nums, int target) {
        int low = 0, high = nums.length-1;
        int tar = -1;
        while (low <= high) {
            int mid = (low+high)/2;
            if (nums[mid] == target) {
                tar = mid;
                break;
            }
            if (nums[mid] > target) {
                high = mid-1;
            }
            if (nums[mid] < target) {
                low = mid + 1;
            }
        }
        if (tar == -1) {
            return new int[] {-1,-1};
        }

        int start = tar, end = tar;
        while (start >= 0 && nums[start] == target ) {
            start = start-1;
        }
        start = start+1;
        while (end < nums.length && nums[end] == target ) {
            end = end + 1;
        }
        end = end-1;

        return new int[] {start, end};
    }