Here you can find the source of fileToURL(File... files)
public static URL[] fileToURL(File... files) throws MalformedURLException
//package com.java2s; //License from project: Apache License import java.io.File; import java.net.MalformedURLException; import java.net.URL; public class Main { public static URL[] fileToURL(File... files) throws MalformedURLException { URL[] urls = new URL[files.length]; int i = 0; for (File file : files) { urls[i] = file.toURI().toURL(); i++;/*w ww. j ava2s. c o m*/ } return urls; } }