if (responseCode / 100 == 2) {//success return handleSuccess(); } else if (responseCode == 401) { return handleNotAuthorized(); } else { // something else }