Mega Code Archive

 
Categories / Java Tutorial / Development
 

Appending a subset of the elements from a char array

public class MainClass {   public static void main(String[] arg) {     StringBuffer buf = new StringBuffer("::");     char[] text = { 'i', 's', ' ', 'e', 'x', 'a', 'c', 't', 'l', 'y'};     buf.append(text, 2, 8);     System.out.println(buf);   } } :: exactly