Here you can find the source of toPrimitive(Character[] in)
public static char[] toPrimitive(Character[] in)
//package com.java2s; public class Main { public static long[] toPrimitive(Long[] in) { return toPrimitive(in, 0L); }//w ww .ja v a 2 s. c om public static int[] toPrimitive(Integer[] in) { return toPrimitive(in, 0); } public static short[] toPrimitive(Short[] in) { return toPrimitive(in, (short) 0); } public static char[] toPrimitive(Character[] in) { return toPrimitive(in, (char) 0); } public static double[] toPrimitive(Double[] in) { return toPrimitive(in, 0.0); } public static long[] toPrimitive(Long[] in, long valueForNull) { if (in == null) return null; final long[] out = new long[in.length]; for (int i = 0; i < in.length; i++) { Long b = in[i]; out[i] = (b == null ? valueForNull : b); } return out; } public static int[] toPrimitive(Integer[] in, int valueForNull) { if (in == null) return null; final int[] out = new int[in.length]; for (int i = 0; i < in.length; i++) { Integer b = in[i]; out[i] = (b == null ? valueForNull : b); } return out; } public static short[] toPrimitive(Short[] in, short valueForNull) { if (in == null) return null; final short[] out = new short[in.length]; for (int i = 0; i < in.length; i++) { Short b = in[i]; out[i] = (b == null ? valueForNull : b); } return out; } public static char[] toPrimitive(Character[] in, char valueForNull) { if (in == null) return null; final char[] out = new char[in.length]; for (int i = 0; i < in.length; i++) { Character b = in[i]; out[i] = (b == null ? valueForNull : b); } return out; } public static double[] toPrimitive(Double[] in, double valueForNull) { if (in == null) return null; final double[] out = new double[in.length]; for (int i = 0; i < in.length; i++) { Double b = in[i]; out[i] = (b == null ? valueForNull : b); } return out; } }