i am getting java.lang.NullPointerException for below code. Don't know where is the mistake. please look at the below code. I am trying to split video into specified size.
import java.io.*;
class Split
{
public static void main(String args[])throws IOException
 {
Console con=System.console();
System.out.println("enter the file path");
String path=con.readLine();
File f= new File(path);
int filesize=(int)f.length();
  try (FileInputStream fis = new FileInputStream(path)) {
      int size;
      System.out.println("enter file size for split");
      size=Integer.parseInt(con.readLine());
      byte b[]=new byte[size];
      int ch,c=0;
      while(filesize>0)
      {
          ch=fis.read(b,0,size);
          filesize = filesize-ch;
          String fname=c+"."+f.getName()+"";
          c++;
          FileOutputStream fos= new FileOutputStream(new File(fname));
          fos.write(b,0,ch);
          fos.flush();
          fos.close();
      }
    }
}
}
