Here you can find the source of cleanPath(String path)
public static String cleanPath(String path)
//package com.java2s; //License from project: Open Source License public class Main { public static String cleanPath(String path) { while (path.endsWith("/") && path.length() > 1) { path = path.substring(0, path.length() - 1); }/* w w w . j a v a 2 s . co m*/ return path; } }