Yes that is correct but a small addition if you do not mind
=====================
I think
File file = new File(name);
name is file name or folder.
and detect file music follow by
if(file.isFile()){
if( file.getName().indexOf(".mp3") > 0);
System.out.print("this is a file mp3");
}
======================================
File file = new File(name);
if(file.isFile()){
String fileName = file.getName();
if( (fileName.lastIndexOf(".mp3")+1) ==
(fileName.length()-".mp3".length())
)
System.out.print("this is a file mp3");
}
Even better is to place the extension in a Constant and use that.