Here you can find the source of getFilesStartingWith(File parentDir, String prefix)
public static HashSet<String> getFilesStartingWith(File parentDir, String prefix)
//package com.java2s; /**//from w w w .j av a2 s.c o m * Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Eclipse Public License (EPL). * Please see the license.txt included with this distribution for details. * Any modifications to this file must keep this entire header intact. */ import java.io.File; import java.util.HashSet; public class Main { public static HashSet<String> getFilesStartingWith(File parentDir, String prefix) { String[] list = parentDir.list(); HashSet<String> hashSet = new HashSet<String>(); if (list != null) { for (String string : list) { if (string.startsWith(prefix)) { hashSet.add(string); } } } return hashSet; } }