This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 53b0a1a8782272a857ebea1b2ceeff59e31ddd13
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat May 31 08:43:46 2025 -0400

    Extract constant
---
 src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index b2963be44..3516231a1 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -46,6 +46,8 @@
 // CheckStyle:HideUtilityClassConstructorCheck OFF (bc)
 public class TarUtils {
 
+    private static final BigInteger NEG_1_BIG_INT = BigInteger.valueOf(-1);
+
     private static final int BYTE_MASK = 255;
 
     static final ZipEncoding DEFAULT_ENCODING = 
ZipEncodingHelper.getZipEncoding(Charset.defaultCharset());
@@ -315,7 +317,7 @@ private static long parseBinaryBigInteger(final byte[] 
buffer, final int offset,
         BigInteger val = new BigInteger(remainder);
         if (negative) {
             // 2's complement
-            val = val.add(BigInteger.valueOf(-1)).not();
+            val = val.add(NEG_1_BIG_INT).not();
         }
         if (val.bitLength() > 63) {
             throw new IllegalArgumentException("At offset " + offset + ", " + 
length + " byte binary number exceeds maximum signed long value");

Reply via email to