Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strings/UsingStringBuilder.java has incorrect results #67

Open
AttackingDinosaur opened this issue Nov 27, 2022 · 1 comment
Open

strings/UsingStringBuilder.java has incorrect results #67

AttackingDinosaur opened this issue Nov 27, 2022 · 1 comment

Comments

@AttackingDinosaur
Copy link

public static String string1() {
Random random = new Random(47);
StringBuilder result = new StringBuilder("[");
for (int i = 0; i < 25; i++) {
result.append(random.nextInt(100));
result.append(",");
}
// This will lead to incorrect results
// [58,55,93,61,61,29,68,0,22,7,88,28,51,89,9,78,98,61,20,58,16,40,11,22,]
result.delete(result.length() - 2, result.length());
result.append("]");
return result.toString();
}

@Mayank-2545
Copy link

Mayank-2545 commented Jun 16, 2023

Hey Buddy I found🪲 have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants