So I have this program and I would want to have Java figure out the username by itself.
import java.io.*;
import java.nio.file.Files;
public class Demo {
public static void main(String[] args) throws IOException {
File file = new File("/Users/angel/Desktop");
String[] files = file.list();
for (String string : files){
for (int i = 0; i < files.length; i++) {
if(String.valueOf(string).contains(".png")){
File sourceFile = new File("/Users/angel/Desktop/" + string);
File destinationFile = new
File("/Users/angel/Desktop/Screenshots/Screenshot" + string );
Files.move(sourceFile.toPath(), destinationFile.toPath());
string = "";
}
}
}
}
}