Java has means of removing duplicates, if double-loop isn't a requirement...
String[] szInput = {"input file---hello.txt file", "hello", "java", "hello", "java", "output file--xyz.txt file", "hello", "java"};
Set<String> szSet = new HashSet<String>(Arrays.asList(szInput));
String[] szOutput = szSet.toArray(new String[szSet.size()]);