Java - Write code to convert array To String

Requirements

Write code to convert array To String

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String[] arr = new String[] { "1", "abc", "level", null,
                "book2s.com", "asdf 123" };
        System.out.println(arrayToString(arr));
    }//from   w w w. j a  va  2  s . c om

    public static String arrayToString(String[] arr) {

        if (arr != null) {
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < arr.length; i++) {
                sb.append(arr[i]);
            }
            //***
            return sb.toString();
        } else
            return null;

    }
}