user355636
user355636

Reputation: 49

Java StringBuilder append long String error

I tried to append a long String (length of 3000) with java StringBuilder and found out that the appended result is not what I expected.

A.append(B) should be AB

A.append(LongString) becomes A________________(empty spaces)

Any idea?

My code: http://pastebin.com/5CPmHFeS

Upvotes: 0

Views: 1211

Answers (2)

Saurabh Gokhale
Saurabh Gokhale

Reputation: 46425

There isn't any problem, that I see.

It works properly : http://www.ideone.com/z8Lxu

Upvotes: 0

squinlan
squinlan

Reputation: 1806

What did you get as output? I got:

sb-320 :404040....
sb-4320:404040....

Truncated for readability, but its correct. I think you may have counted the digits incorrectly. Double check?

Upvotes: 1

Related Questions