Here you can find the source of normalize(String path, String separator)
private static String normalize(String path, String separator)
//package com.java2s; //License from project: LGPL public class Main { private static String normalize(String path, String separator) { path = path.replace(separator + separator, separator); path = path.replace(separator + separator, separator); if (path.endsWith(separator)) { path = path.substring(0, path.length() - 1); }/*from w w w .j a va2 s .c om*/ return path; } }