Here you can find the source of normalize(String path)
public static String normalize(String path)
//package com.java2s; /**// w ww . j a va 2 s . com * (C) 2011-2012 Alibaba Group Holding Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * */ public class Main { public static final String SEPARATOR = "/"; public static String normalize(String path) { String temp = path; if (!path.startsWith(SEPARATOR)) { temp = SEPARATOR + path; } if (path.endsWith(SEPARATOR)) { temp = temp.substring(0, temp.length() - 1); return normalize(temp); } else { return temp; } } }