Fix SAT warnings (#14202)
* Fix SAT warnings - checkstyle.ModifierOrderCheck - checkstyle.OneStatementPerLineCheck - checkstyle.NeedBracesCheck - PMD.UseStandardCharsets - PMD.UseCollectionIsEmpty - PMD.UnusedLocalVariable - PMD.SimplifyBooleanReturns where reasonable, suppress where readability is better without change - PMD.SimplifyBooleanExpressions * Include StandardCharsets Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -30,8 +30,9 @@ public class PercentageConverter {
|
||||
* @return if hexRepresentation == null return -1, otherwise return percentage
|
||||
*/
|
||||
public static int getPercentage(@Nullable String hexRepresentation) {
|
||||
if (hexRepresentation == null)
|
||||
if (hexRepresentation == null) {
|
||||
return -1;
|
||||
}
|
||||
int decimal = Integer.parseInt(hexRepresentation, 16);
|
||||
BigDecimal level = new BigDecimal(100 * decimal).divide(new BigDecimal(255), RoundingMode.FLOOR);
|
||||
return level.intValue();
|
||||
|
||||
Reference in New Issue
Block a user