ppkarwasz commented on code in PR #702:
URL: https://github.com/apache/commons-compress/pull/702#discussion_r2312310753


##########
src/main/java/org/apache/commons/compress/harmony/pack200/IntList.java:
##########
@@ -120,6 +120,19 @@ public int get(final int location) {
         throw new IndexOutOfBoundsException("" + location);
     }
 
+
+
+    private int calculateIncrement(final int size, final int required) {
+        int increment = size / 2;
+        if (required > increment) {
+            increment = required;
+        }
+        if (increment < 12) {
+            increment = 12;
+        }
+        return increment;

Review Comment:
   You can use `NumberUtils` for this:
   ```suggestion
           return NumberUtils.max(size / 2, required, 12);
   ```
   
   Additionally I would:
   
   - Make the method `static`.
   - Optionally extract the constant 12 to a `MIN_INCREMENT` constant, although 
for this single usage, it is not really necessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to