Here you can find the source of removeNullsFromStringArray(String[] array)
public static String[] removeNullsFromStringArray(String[] array)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; public class Main { public static String[] removeNullsFromStringArray(String[] array) { ArrayList<String> arrayList = new ArrayList<String>(); for (int i = 0; i < array.length; i++) { if (array[i] != null && !array[i].equals("")) { arrayList.add(array[i]); }// w w w . j a va2 s . com } String[] newArray = arrayList.toArray(new String[arrayList.size()]); return newArray; } }