Here you can find the source of makePath(String filename, String savePath)
public static String makePath(String filename, String savePath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String makePath(String filename, String savePath) { int hashcode = filename.hashCode(); int dir1 = hashcode & 0xf; // 0--15 int dir2 = (hashcode & 0xf0) >> 4; // 0-15 String dir = savePath + File.separator + dir1 + File.separator + dir2; File file = new File(dir); if (!file.exists()) { file.mkdirs();//from w w w. j a va 2s. c o m file.setWritable(true, false); } return dir; } }