Here you can find the source of normalizePath(String path)
public static String normalizePath(String path)
//package com.java2s; //License from project: Open Source License public class Main { public static String normalizePath(String path) { if (path == null || path.length() == 0) { path = "/"; } else if (!path.startsWith("/")) { path = "/" + path.trim(); } else {/*from ww w. j a v a2 s .c o m*/ path = path.trim(); } if (path.length() > 1 && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } return path; } }