public static boolean existeUsuario(String username) {
            username = username.trim();
            Connection conn = null;
            PreparedStatement stmt = null;
            boolean existe = false;
            try {
                  conn = model.ConexionMySQL.darConexion();
                  stmt = conn.prepareStatement("SELECT count(*) as count from usuario where username=?");
                  stmt.setString(1, username);
                  ResultSet result = stmt.executeQuery();
                  while (result.next()) {
                        int val = Integer.parseInt(result.getString("count"));
                        if (val > 0) {
                              existe = true;
                        }
                  }
            } catch (SQLException e) {
            } finally {
                  if (stmt != null) {
                        try {
                              stmt.close();
                        } catch (SQLException ex) {
                        }
                  }
                  if (conn != null) {
                        try {
                              conn.close();
                        } catch (SQLException ex) {
                        }
                  }
            }
            return existe;
      }