package interview; public class SubStringTest { public static void main(String[] args) { String s="1234"; for(int i=s.length();i>0;i--) { for(int j=0;i+j<=s.length();j++) { System.out.print(s.substring(j, i+j)+","); } } } }