code: public boolean tableContainsIndex (Connection conn, String table, String index)
          throws SQLException
      {
          ResultSet rs = conn.getMetaData().getIndexInfo(null, null, table, false, true);
          while (rs.next()) {
              String tname = rs.getString("TABLE_NAME");
              String iname = rs.getString("INDEX_NAME");
              if (tname.equals(table) && index.equals(iname)) {
                  return true;
              }
          }
          return false;
      }
docs: from DatabaseLiaison