Here you can find the source of rename(String from, String to)
public static File rename(String from, String to)
//package com.java2s; import java.io.File; public class Main { public static File rename(String from, String to) { File file = new File(from); file.renameTo(new File(to)); return file; }// w w w .java 2s . c o m }