public static void copyFile(String sourcePath, String targetPath) {
        // define files
        File sourceFile = new File(sourcePath);
        File targetFile = new File(targetPath);

        // define stream
        InputStream is = null;
        OutputStream os = null;

        int byteread = 0;
        byte[] cbuf = new byte[1024];

        try {
            is = new FileInputStream(sourceFile);
            os = new FileOutputStream(targetFile);

            while ((byteread = is.read(cbuf)) != -1) {
                os.write(cbuf, 0, byteread);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (is != null)
                try {
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            if (os != null)
                try {
                    os.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }
    }