HOME      BLOG       FORUMS      CONTACT       ABOUT

Copy the characters of a StringBuffer to a characters array

Copy the characters of a StringBuffer to a characters array

public class StringBufferExample {
	public static void main(String[] args) {
		StringBuffer buff = new StringBuffer("Hello World");
		
		char value[] = new char[5];
		buff.getChars(0, 5, value, 0);
		
		System.out.println(new String(value));
	}
}

Share

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply