comefrom: <awangdev>Last Position of Target_1.java
code: public int lastPosition(int[] A, int target) {
      	if (A == null || A.length == 0) {
      		return -1;
      	}
      	int start = 0;
      	int end = A.length - 1;
      	int mid;
  
      	while(start + 1 < end) {
      		mid = start + (end - start)/2;
      		if (A[mid] == target) {
      			if (mid + 1 < A.length && A[mid + 1] == target) {
      				start = mid;
      			} else {
      				return mid;
      			}
      		} else if (A[mid] < target) {
      			start = mid;
      		} else {
      			end = mid;
      		}
      	}
      	
      	if (A[end] == target) {
      		return end;
      	} else if (A[start] == target) {
      		return start;
      	}
      	
      	return -1;
      }
masked: public int sample_funcname ( int [ ] var_0 , int var_1 ) {
    if ( var_0 == null || var_0 . length == 0 ) {
      return - 1 ;
    }
    int var_2 = 0 ;
    int var_3 = var_0 . length - 1 ;
    int var_4 ;
    while ( var_2 + 1 < var_3 ) {
      var_4 = var_2 + ( var_3 - var_2 ) / 2 ;
      if ( var_0 [ var_4 ] == var_1 ) {
        if ( var_4 + 1 < var_0 . length && var_0 [ var_4 + 1 ] == var_1 ) {
          var_2 = var_4 ;
        }
        else {
          return var_4 ;
        }
      }
      else if ( var_0 [ var_4 ] < var_1 ) {
        var_2 = var_4 ;
      }
      else {
        var_3 = var_4 ;
      }
    }
    if ( var_0 [ var_3 ] == var_1 ) {
      return var_3 ;
    }
    else if ( var_0 [ var_2 ] == var_1 ) {
      return var_2 ;
    }
    return - 1 ;
  }
  