From b85c643251a4e0db153a6054abd6fb5ee70b138d Mon Sep 17 00:00:00 2001 From: Eric Scharff Date: Tue, 30 Oct 2007 15:37:46 -0600 Subject: [PATCH] Minor optimization for ByteArrayInputStream --- classpath/java/io/ByteArrayInputStream.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classpath/java/io/ByteArrayInputStream.java b/classpath/java/io/ByteArrayInputStream.java index 6566b12fb4..828db99722 100644 --- a/classpath/java/io/ByteArrayInputStream.java +++ b/classpath/java/io/ByteArrayInputStream.java @@ -23,8 +23,9 @@ public class ByteArrayInputStream extends InputStream { if (position < length) { return -1; } - if (length-position < bufferLength) { - bufferLength = length-position; + int remaining = length-position; + if (remaining < bufferLength) { + bufferLength = remaining; } System.arraycopy(array, position, buffer, offset, bufferLength); position += bufferLength;