private static String removeBrackets(String subQuery){
  if (subQuery.indexOf('(') == 0 && subQuery.lastIndexOf(')') == subQuery.length() - 1) {
    return subQuery.substring(1,subQuery.length() - 1);
  }
  return subQuery;
}

private static String removeBrackets ( String subQuery ) { if ( subQuery . indexOf ( '(' ) == 0 && subQuery . lastIndexOf ( ')' ) == subQuery . length ( ) - 1 ) { return subQuery . substring ( 1 , subQuery . length ( ) - 1 ) ; } return subQuery ; }
removes the first and the last bracket from the sub - query .
