src/com/company/Server/ReadWriteFiles.java
public boolean userExists(int id) {
        boolean exist = false;

        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));

            JSONArray listUsers = (JSONArray) obj.get("Registry");

            int i = 0;
            JSONObject user;

            while (!exist && i < listUsers.size()) {
                user = (JSONObject) listUsers.get(i);

                if (Integer.parseInt(user.get("id").toString()) == id) {
                    exist = true;
                }

                i++;
            }
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }

        return exist;
    }
/**
     * Method responsible for verifying whether a client exists or not, given its id in the JSON file
     *
     * @param id client's id
     * @return true if the client exists, otherwise it returns false
     */
Method responsible for verifying whether a client exists or not, given its id in the JSON file
@param id client's id
@return true if the client exists, otherwise it returns false
Method responsible for verifying whether a client exists or not given its id in the JSON file @param id client ' s id @return true if the client exists otherwise it returns false
public boolean userExists(int id) {
        boolean exist = false;
        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));
            JSONArray listUsers = (JSONArray) obj.get("Registry");
            int i = 0;
            JSONObject user;
            while (!exist && i < listUsers.size()) {
                user = (JSONObject) listUsers.get(i);
                if (Integer.parseInt(user.get("id").toString()) == id) {
                    exist = true;
                }
                i++;
            }
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }
        return exist;
    }
public boolean userExists ( int id ) { boolean exist = false ; try { JSONObject obj = ( JSONObject ) jsonParser . parse ( new FileReader ( file . getPath ( ) ) ) ; JSONArray listUsers = ( JSONArray ) obj . get ( "Registry" ) ; int i = 0 ; JSONObject user ; while ( ! exist && i < listUsers . size ( ) ) { user = ( JSONObject ) listUsers . get ( i ) ; if ( Integer . parseInt ( user . get ( "id" ) . toString ( ) ) == id ) { exist = true ; } i ++ ; } } catch ( IOException | ParseException e ) { e . printStackTrace ( ) ; } return exist ; }
Method responsible for verifying whether a client exists or not, given its id in the JSON file
 @param id client's id
 @return true if the client exists, otherwise it returns false
Method responsible for verifying whether a client exists or not given its id in the JSON file @param id client ' s id @return true if the client exists otherwise it returns false