src/com/company/Server/ReadWriteFiles.java
public int indexUnregisteredUsers(int id) {
        int position = -1;

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

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

            int i = 0;
            JSONObject user;
            boolean found = false;

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

                if (Integer.parseInt(user.get("id").toString()) == id) {
                    found = true;
                } else {
                    i++;
                }
            }

            if (found) {
                position = i;
            }
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }

        return position;
    }
/**
     * Method responsible for returning the index of the client's position that is not yet registered in the application
     *
     * @param id client's id
     * @return the client's position if it exists, otherwise it returns -1
     */
Method responsible for returning the index of the client's position that is not yet registered in the application
@param id client's id
@return the client's position if it exists, otherwise it returns -1
Method responsible for returning the index of the client ' s position that is not yet registered in the application @param id client ' s id @return the client ' s position if it exists otherwise it returns - 1
public int indexUnregisteredUsers(int id) {
        int position = -1;
        try {
            JSONObject obj = (JSONObject) jsonParser.parse(new FileReader(file.getPath()));
            JSONArray listUsers = (JSONArray) obj.get("UnregisteredUsers");
            int i = 0;
            JSONObject user;
            boolean found = false;
            while (!found && i < listUsers.size()) {
                user = (JSONObject) listUsers.get(i);
                if (Integer.parseInt(user.get("id").toString()) == id) {
                    found = true;
                } else {
                    i++;
                }
            }
            if (found) {
                position = i;
            }
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }
        return position;
    }
public int indexUnregisteredUsers ( int id ) { int position = - 1 ; try { JSONObject obj = ( JSONObject ) jsonParser . parse ( new FileReader ( file . getPath ( ) ) ) ; JSONArray listUsers = ( JSONArray ) obj . get ( "UnregisteredUsers" ) ; int i = 0 ; JSONObject user ; boolean found = false ; while ( ! found && i < listUsers . size ( ) ) { user = ( JSONObject ) listUsers . get ( i ) ; if ( Integer . parseInt ( user . get ( "id" ) . toString ( ) ) == id ) { found = true ; } else { i ++ ; } } if ( found ) { position = i ; } } catch ( IOException | ParseException e ) { e . printStackTrace ( ) ; } return position ; }
Method responsible for returning the index of the client's position that is not yet registered in the application
 @param id client's id
 @return the client's position if it exists, otherwise it returns -1
Method responsible for returning the index of the client ' s position that is not yet registered in the application @param id client ' s id @return the client ' s position if it exists otherwise it returns - 1