String strZero = "0000000";
String str1;str1 = Integer.toString(int);
str1 = strZreo.substring(0, 7 - str1.length()) + str1;

解决方案 »

  1.   

    第一个问题:
    File类有个这样的方法:
    public long lastModified()Returns the time that the file denoted by this abstract pathname was last modified. Returns:
    A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs 
    Throws: 
    SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the file得到的是1970年7(?January(7月吧))月1号到现在流逝的milliseconds ,你可以跟今天的milliseconds 比较 ,看看是不是今天修改的。其他什么判定一个文件不存在,和写入这个文件,这么简单的问题就不要说了吧:)