Java tutorial
//package com.java2s; public class Main { static String[] splitFileName(String fileName) { String name = fileName; String extension = ""; int i = fileName.lastIndexOf("."); if (i != -1) { name = fileName.substring(0, i); extension = fileName.substring(i); } return new String[] { name, extension }; } }