code: public static String getIndexName (Connection conn, String table,
                                         String column)
          throws SQLException
      {
          ResultSet rs = conn.getMetaData().getIndexInfo("", "", table, false, true);
          while (rs.next()) {
              String tname = rs.getString("TABLE_NAME");
              String cname = rs.getString("COLUMN_NAME");
              String iname = rs.getString("INDEX_NAME");
              if (tname.equals(table) && cname.equals(column)) {
                  return iname;
              }
          }
          return null;
      }
docs: Returns the name of the index for the specified column in the specified table.