A few pointers:
a) Fix your code indentation - very hard to read even in the code tags
b) Null Pointer - the exception should indicate the very line it is thrown on. When is the File f variable...