diff --git a/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java b/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java index a7cff3693..229d2f6cb 100644 --- a/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java +++ b/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java @@ -29,7 +29,7 @@ import java.util.Objects; */ public class ClassLoaderUtils { - private static final URL[] EMPTY_URL_ARRAY = new URL[] {}; + private static final URL[] EMPTY_URL_ARRAY = {}; /** * Gets the system class loader's URLs, if any. diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java index 15cbb14e6..fdd0eb119 100644 --- a/src/main/java/org/apache/commons/lang3/JavaVersion.java +++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java @@ -236,7 +236,7 @@ public enum JavaVersion { return JAVA_21; default: final float v = toFloatVersion(versionStr); - if ((v - 1.) < 1.) { // then we need to check decimals > .9 + if (v - 1. < 1.) { // then we need to check decimals > .9 final int firstComma = Math.max(versionStr.indexOf('.'), versionStr.indexOf(',')); final int end = Math.max(versionStr.length(), versionStr.indexOf(',', firstComma)); if (Float.parseFloat(versionStr.substring(firstComma + 1, end)) > .9f) { diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java index 3583715ca..4a02cbc7b 100644 --- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java @@ -398,7 +398,7 @@ public class DateUtils { private static long getFragment(final Calendar calendar, final int fragment, final TimeUnit unit) { Objects.requireNonNull(calendar, "calendar"); long result = 0; - final int offset = (unit == TimeUnit.DAYS) ? 0 : 1; + final int offset = unit == TimeUnit.DAYS ? 0 : 1; // Fragments bigger than a day require a breakdown to days switch (fragment) { @@ -1122,7 +1122,7 @@ public class DateUtils { // truncate seconds final int seconds = val.get(Calendar.SECOND); if (!done && (ModifyType.TRUNCATE == modType || seconds < 30)) { - time = time - (seconds * 1000L); + time = time - seconds * 1000L; } if (field == Calendar.MINUTE) { done = true; @@ -1131,7 +1131,7 @@ public class DateUtils { // truncate minutes final int minutes = val.get(Calendar.MINUTE); if (!done && (ModifyType.TRUNCATE == modType || minutes < 30)) { - time = time - (minutes * 60000L); + time = time - minutes * 60000L; } // reset time @@ -1220,7 +1220,7 @@ public class DateUtils { //Calculate the offset from the minimum allowed value offset = val.get(aField[0]) - min; //Set roundUp if this is more than half way between the minimum and maximum - roundUp = offset > ((max - min) / 2); + roundUp = offset > (max - min) / 2; } //We need to remove this field if (offset != 0) {