This might not be the best implementation, but this might give you an idea. I have used a StringBuffer in the code below because String is immutable. HTH
import java.text.DateFormat;
import java.util.*;
public class LargestString
{
public static void main(String args[])
{
ArrayList <String> list = new ArrayList<String>();
list.add("ABC");
list.add("XYZ");
list.add("KLM");
StringBuffer largest = new StringBuffer("");
for(int i=0; i<list.size(); i++){
if(list.get(i).compareTo(largest.toString())>0){
largest.setLength(0);
largest.append(list.get(i));
}
}
System.out.println(largest.toString());
}
}