Here you can find the source of toCharArray(String string)
public static char[] toCharArray(String string)
//package com.java2s; //License from project: Open Source License public class Main { public static char[] toCharArray(String string) { char[] result = new char[string.length()]; for (int i = 0; i < result.length; i++) { result[i] = string.charAt(i); }/*ww w . ja va 2 s. com*/ return result; } }