Refactoring + javadoc for calculateHealthBarColor