private String getNewFileName() { final int lastDotIndex = this.fileName.lastIndexOf("."); String newFileName = ""; String timestamp = "-" + DateTools.getFileTimestamp(); if (lastDotIndex != -1) { newFileName = this.fileName.substring(0, lastDotIndex) + timestamp + this.fileName.substring(lastDotIndex); } else { newFileName = this.fileName + timestamp; } return newFileName; } }