Java - Write code to append value to a string with System.arraycopy

Requirements

Write code to append value to a string with System.arraycopy

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String[] array = new String[] { "1", "abc", "level", null,
                "book2s.com", "asdf 123" };
        String value = "book2s.com";
        System.out.println(java.util.Arrays.toString(append(array, value)));
    }/*from  ww w.  j  ava2  s  . c o  m*/

    public static String[] append(String[] array, String... value) {
        String[] newArray = new String[array.length + value.length];

        System.arraycopy(array, 0, newArray, 0, array.length);
        System.arraycopy(value, 0, newArray, array.length, value.length);

        return newArray;
    }

    public static String toString(Object value, String defaultValue) {

        if (value != null) {
            return value.toString();
        } else {
            return defaultValue;
        }
    }
}