Convert File to array of bytes using java

Convert File to array of bytes in JAVA:

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
//other stuff and declarations
public byte[] getFileAsByte(String path) {
	if(path!=null){
		byte[] byteFile;
		try {
			byteFile = Files.readAllBytes(new File(path).toPath());
			return byteFile;
		} catch (IOException e) {
			return null;
		}
	}
	return null;
}