Java tutorial
public class MainClass { public static void main(String[] arg) { StringBuffer newString = new StringBuffer("abcde1234567890"); System.out.println(newString.capacity()); System.out.println(newString.length()); System.out.println(newString); newString.setLength(8); System.out.println(newString.capacity()); System.out.println(newString.length()); System.out.println(newString); } }