private static List<Integer[]> confirmedLocations(String str,List<Integer> possibleLocations){
  List<Integer[]> confirmedLocations=new ArrayList<Integer[]>();
  Integer[] lastPair={-1,-1};
  for (  Integer start : possibleLocations) {
    int length=0;
    if (start != 0 && str.charAt(start - 1) == '\\') {
      continue;
    }
    boolean found=false;
    for (int i=start; i < str.length(); i++) {
      length+=1;
      if (str.charAt(i) == '}') {
        found=true;
        break;
      }
    }
    if ((lastPair[0] + lastPair[1] < start) && found) {
      Integer[] pair={start,length};
      confirmedLocations.add(pair);
    }
  }
  return confirmedLocations;
}

private static List < Integer [ ] > confirmedLocations ( String str , List < Integer > possibleLocations ) { List < Integer [ ] > confirmedLocations = new ArrayList < Integer [ ] > ( ) ; Integer [ ] lastPair = { - 1 , - 1 } ; for ( Integer start : possibleLocations ) { int length = 0 ; if ( start != 0 && str . charAt ( start - 1 ) == '\\' ) { continue ; } boolean found = false ; for ( int i = start ; i < str . length ( ) ; i ++ ) { length += 1 ; if ( str . charAt ( i ) == '}' ) { found = true ; break ; } } if ( ( lastPair [ 0 ] + lastPair [ 1 ] < start ) && found ) { Integer [ ] pair = { start , length } ; confirmedLocations . add ( pair ) ; } } return confirmedLocations ; }
confirm interpolation sites by looking for a closing brace .
