NOTE
StringBuffer
Legacy synchronized mutable text builder and its relationship to StringBuilder.
This is a historical learning note and may contain outdated or incomplete understanding.
StringBuffer is a mutable character-sequence builder whose operations are synchronized.
It exists largely for legacy/thread-safe builder use cases. Synchronizing individual method calls does not automatically make a larger multi-step text-building protocol logically atomic.
For ordinary single-threaded/local construction, prefer StringBuilder.