From 7ea3c430aa0e71d84608bcb2e187ae298ae236f9 Mon Sep 17 00:00:00 2001
From: zzz <zzz@i2pmail.org>
Date: Sat, 28 May 2022 12:32:39 -0400
Subject: [PATCH] Util: FileLogWriter minor optimization

---
 core/java/src/net/i2p/util/FileLogWriter.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/core/java/src/net/i2p/util/FileLogWriter.java b/core/java/src/net/i2p/util/FileLogWriter.java
index 5ec7512b0d..dddce27f71 100644
--- a/core/java/src/net/i2p/util/FileLogWriter.java
+++ b/core/java/src/net/i2p/util/FileLogWriter.java
@@ -207,11 +207,12 @@ class FileLogWriter extends LogWriter {
     }
 
     private static final String replace(String pattern, int num) {
-        char c[] = pattern.toCharArray();
-        StringBuilder buf = new StringBuilder();
-        for (int i = 0; i < c.length; i++) {
-            if ( (c[i] != '#') && (c[i] != '@') )
-                buf.append(c[i]);
+        int len = pattern.length();
+        StringBuilder buf = new StringBuilder(len + 1);
+        for (int i = 0; i < len; i++) {
+            char c = pattern.charAt(i);
+            if ( (c != '#') && (c != '@') )
+                buf.append(c);
             else
                 buf.append(num);
         }
-- 
GitLab