Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.ArrayList; public class Main { public static File[] getSavegames(File folder) { File[] files = folder.listFiles(); ArrayList<File> saveFiles = new ArrayList<File>(); if (files != null) { for (final File fileEntry : files) { if (fileEntry.isFile()) { if (fileEntry.getName().toLowerCase().endsWith(".lsd")) { saveFiles.add(fileEntry); } } } } return saveFiles.toArray(new File[saveFiles.size()]); } }