Move file java example

public static void moveFiles(File source, File dest) {

             InputStream inStream = null;

             OutputStream outStream = null;

             try{

                    inStream = new FileInputStream(source);

                    outStream = new FileOutputStream(dest);

                    byte[] buffer = new byte[1024];

                    int length;

                    while ((length = inStream.read(buffer)) > 0){

                           outStream.write(buffer, 0, length);

                    }

                    inStream.close();

                    outStream.close();

                    source.delete();

             }catch(IOException e){

                    e.printStackTrace();

             }

       }