Here you can find the source of makeDirectory(final File file, final String extension)
public static File makeDirectory(final File file, final String extension)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static File makeDirectory(final File file, final String extension) { String name = file.getName(); name = capitalizeFirstLetter(name); name = name.replace(".gz", ""); name = name.replace(".zip", ""); name = removeExtension(name);/*from w w w . j ava 2 s .c o m*/ final File dir = new File(file.getParentFile(), name + extension); dir.mkdir(); return dir; } public static String capitalizeFirstLetter(final String s) { final char[] first = s.toCharArray(); if (Character.isLetter(first[0])) { first[0] = Character.toUpperCase(first[0]); return new String(first); } return s; } public static String removeExtension(final String txt) { final int index = txt.lastIndexOf("."); if (index != -1) { return txt.substring(0, index); } return txt; } }