Java tutorial
//package com.java2s; public class Main { public static String getFilePathOfPhoto(String photoPath, String photoName) { return filePathAddEndSprit(photoPath) + fileNameAddEndJPG(photoName); } public static String filePathAddEndSprit(String filePath) { if (null != filePath && !filePath.endsWith("/")) return filePath + "/"; return filePath; } public static String fileNameAddEndJPG(String photoName) { if (null == photoName) return photoName; String name = photoName; if (!name.endsWith(".jpg")) name = name + ".jpg"; return name; } }