Java Data Type Tutorial - Java StringBuilder.insert(int offset, char[] str)








Syntax

StringBuilder.insert(int offset, char[] str) has the following syntax.

public StringBuilder insert(int offset,   char[] str)

Example

In the following code shows how to use StringBuilder.insert(int offset, char[] str) method.

/*from   w  ww  .j  av a  2  s  .com*/
public class Main {
  public static void main(String args[]) {
    StringBuilder buffer = new StringBuilder();


    char charArray[] = { 'a', 'b', 'c', 'd', 'e', 'f' };
    buffer.insert(0, charArray);

    System.out.println(buffer.toString());
    
  }
}

The code above generates the following result.