diff --git a/core/src/main/java/hudson/org/apache/tools/tar/TarInputStream.java b/core/src/main/java/hudson/org/apache/tools/tar/TarInputStream.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/org/apache/tools/tar/TarInputStream.java
+++ b/core/src/main/java/hudson/org/apache/tools/tar/TarInputStream.java
@@ -326,8 +326,7 @@ public class TarInputStream extends FilterInputStream {
         }
 
         if (this.readBuf != null) {
-            int sz = (numToRead > this.readBuf.length) ? this.readBuf.length
-                    : numToRead;
+            int sz = Math.min(numToRead, this.readBuf.length);
 
             System.arraycopy(this.readBuf, 0, buf, offset, sz);
Replace manual min/max calculation with Math#min