import java.util.*;public class Solution { public String ReverseSentence(String str) { if(str==null||str.length()==0){ return ""; }if(str.trim().equals("")){ return str; } String[] strings = str.split(" "); Listlist = new ArrayList<>(); for(int i = strings.length - 1;i>=0;i--){ list.add(strings[i]); } StringBuffer stringBuffer = new StringBuffer(); for(int i =0;i