private static String[] composeList(MessageFormat format,String[] list){
  if (list.length <= 3)   return list;
  String[] listItems={list[0],list[1]};
  String newItem=format.format(listItems);
  String[] newList=new String[list.length - 1];
  System.arraycopy(list,2,newList,1,newList.length - 1);
  newList[0]=newItem;
  return composeList(format,newList);
}

private static String [ ] composeList ( MessageFormat format , String [ ] list ) { if ( list . length <= 3 ) return list ; String [ ] listItems = { list [ 0 ] , list [ 1 ] } ; String newItem = format . format ( listItems ) ; String [ ] newList = new String [ list . length - 1 ] ; System . arraycopy ( list , 2 , newList , 1 , newList . length - 1 ) ; newList [ 0 ] = newItem ; return composeList ( format , newList ) ; }
given a list of strings , return a list shortened to three elements . shorten it by applying the given format to the first two elements recursively .
