Here you can find the source of combinePath(String path1, String path2)
public static String combinePath(String path1, String path2)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static String combinePath(String path1, String path2) { if (path1.endsWith(File.separator) && path2.startsWith(File.separator)) { return path1 + path2.substring(1); }// w w w. j a v a 2s .c o m if (path1.endsWith(File.separator) || path2.startsWith(File.separator)) { return path1 + path2; } return path1 + File.separator + path2; } }