Loop Through a Given Directory With Indentation in Java

The code below provide a method for recursively loop through a directory in Java. It also prints out the directory hierarchy with indentation. package com.programcreek;   import java.io.File; import org.apache.commons.lang3.StringUtils;   public class LoopThroughADirectory {   public static void main(String[] args) { File[] files = new File("/home/programcreek/Desktop").listFiles(); showFiles(files); }   public static void showFiles(File[] files) … Read more