You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/11/26 15:41:07 UTC

(commons-compress) 02/04: No need for a local variable

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 084f078bb0b6f199726d74739100b0e153ba52d2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Nov 26 10:30:04 2024 -0500

    No need for a local variable
---
 .../apache/commons/compress/archivers/zip/ZipEightByteInteger.java   | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
index dac4b958d..b02bdb6f8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
@@ -58,9 +58,7 @@ public final class ZipEightByteInteger implements Serializable {
      * @return value as eight bytes in big-endian byte order
      */
     public static byte[] getBytes(final long value) {
-        final ByteBuffer buffer = ByteBuffer.allocate(BYTES).order(ByteOrder.LITTLE_ENDIAN);
-        buffer.putLong(value);
-        return buffer.array();
+        return ByteBuffer.allocate(BYTES).order(ByteOrder.LITTLE_ENDIAN).putLong(value).array();
     }
 
     /**
@@ -114,7 +112,6 @@ public final class ZipEightByteInteger implements Serializable {
         }
         return BigInteger.valueOf(value & Long.MAX_VALUE).add(HIGHEST_BIT);
     }
-
     private final long value;
 
     /**