Here you can find the source of buildPath(long id, boolean justDir)
private static String buildPath(long id, boolean justDir)
//package com.java2s; //License from project: Apache License public class Main { private static String buildPath(long id, boolean justDir) { StringBuilder fileBuffer = new StringBuilder(); fileBuffer.append(id);//from www. ja v a 2 s .co m // Pad out e.g. 10100 -> 010100 while ((fileBuffer.length() % 3) != 0) { fileBuffer.insert(0, '0'); } StringBuilder dirBuffer = new StringBuilder(); for (int i = 0; i < fileBuffer.length() - 3; i += 3) { dirBuffer.append(fileBuffer.subSequence(i, i + 3)); dirBuffer.append("/"); } if (justDir) { return dirBuffer.toString(); } else { return dirBuffer.toString() + fileBuffer.toString(); } } }