https://www.codewars.com/kata/550554fd08b86f84fe000a58/train/javajava
package codewars; //--https://www.codewars.com/kata/550554fd08b86f84fe000a58/train/java import java.util.*; public class WhichAreIn{ private static Boolean isSubstring(String str, String[] arr){ for(String x : arr){ if(x.contains(str)){ return true; } } return false; } public static String[] inArray(String[] array1, String[] array2){ Arrays.sort(array1); List<String> list = new ArrayList<String>(); for(String x : array1){ if(WhichAreIn.isSubstring(x, array2)){ list.add(x); } } return list.toArray(new String[0]); } }