public static Torrent parseTorrentFile(String filePath) throws IOException, NoSuchAlgorithmException{
		//get file
		File file = new File(filePath);
		int len =(int) file.length();
		byte[] data = new byte[len];
		Files.newInputStream(file.toPath()).read(data);
		Bencoding encoding = new Bencoding(data);
		
		Bencoding info = encoding.dictionary.get("info");
		String name = info.dictionary.get("name").getString();
		byte [] byteStringHashInfo = SHAsum(info.toByteArray());
		String urlEncodedHash = urlEncode(byteStringHashInfo);
		long totalBytes = 0;
		int numFiles;
		DownloadFile dfiles[]; 
		if(info.dictionary.containsKey("files")){//multiple files
			Bencoding files=info.dictionary.get("files");
			numFiles = files.list.size();
			dfiles=new DownloadFile[numFiles];
			int i=0;
			for(Bencoding b:files.list){
				long integ=b.dictionary.get("length").integer;
				
				String dlFilePath="";
				for(Bencoding e : b.dictionary.get("path").list){
					dlFilePath+=e.getString();
				}
				dfiles[i] = new DownloadFile(name,dlFilePath,new Long(integ),totalBytes);
				i++;
				totalBytes+=integ;
			}
		}else{
			numFiles = 1;
			dfiles=new DownloadFile[numFiles];
			totalBytes=info.dictionary.get("length").integer;
			dfiles[0] = new DownloadFile(name,name,totalBytes,0);
		}
		
		List<Tracker> trackers = new ArrayList<Tracker>();
		String primaryTracker = encoding.dictionary.get("announce").getString();
		Tracker t = Tracker.makeTracker(primaryTracker);
		if(t!=null){
			trackers.add(t);
		}
		
		if(encoding.dictionary.containsKey("announce-list")){
			for(Bencoding b : encoding.dictionary.get("announce-list").list){
				t = Tracker.makeTracker(b.list.get(0).getString());
				if(t!=null){
					trackers.add(t);
				}
			}
		}
		
		int pieceLength=(int) ((long)(info.dictionary.get("piece length").integer));//TODO: Rofl! yeah why cant i just do new Integer()?
		Bencoding pieceHashes=info.dictionary.get("pieces");
		
		
		
		
		
		Torrent torrent = new Torrent(name,pieceLength,dfiles,totalBytes,byteStringHashInfo,urlEncodedHash,pieceHashes,new MetaData(info),trackers,filePath);
		return torrent;
	}