StringBuilderUtils { public static boolean equals(@NonNull StringBuilder stringBuilder, @NonNull String equal) { int builderLength = stringBuilder.length(); if (builderLength != equal.length()) { return false; } for (int n = 0; n < builderLength; n++) { if (stringBuilder.charAt(n) != equal.charAt(n)) { return false; } } return true; }  static void replace(@NonNull StringBuilder stringBuilder,
                        @NonNull String toReplace,
                        @NonNull String replacement); static void trim(@NonNull StringBuilder stringBuilder); static boolean isEmpty(@NonNull StringBuilder stringBuilder); static boolean startsWith(@NonNull StringBuilder stringBuilder, @NonNull String start); static boolean contains(@NonNull StringBuilder stringBuilder, @NonNull String contains); static boolean equals(@NonNull StringBuilder stringBuilder, @NonNull String equal); @NonNull static StringBuilder substring(@NonNull StringBuilder stringBuilder, int start, int end);  }
@Test public void equals_DifferentCharacters() { StringBuilder stringBuilder = new StringBuilder("abcdefg"); Assert.assertFalse(StringBuilderUtils.equals(stringBuilder, "abcdefg1")); }
@Test public void equals_SameCharacters() { StringBuilder stringBuilder = new StringBuilder("abcdefg"); Assert.assertTrue(StringBuilderUtils.equals(stringBuilder, "abcdefg")); }