package csci599;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class JSONGenerator
{
    public static String generateJSON(HashMap<String,ArrayList<Double>> fingerprint,HashMap<String,ArrayList<Double>> correlationStrengths)
    {
        String json="{";
        for(Object MIMEType:fingerprint.keySet())
        {
            json=json+"\""+MIMEType+"\": ";
            json=json+"{";
            json=json+"\"BFD\": ";
            json=json+"[";
            Iterator i1=fingerprint.get(MIMEType).iterator();
            while(i1.hasNext())
                json=json+i1.next()+",";
            json=json.substring(0, json.length()-1);
            json=json+"],\n";
            json=json+"\"CS\": ";
            json=json+"[";
            Iterator i2=correlationStrengths.get(MIMEType).iterator();
            while(i2.hasNext())
                json=json+i2.next()+",";
            json=json.substring(0, json.length()-1);
            json=json+"]";
            json=json+"},";
        }
        json=json.substring(0, json.length()-1);
        json=json+"}";
        return json;
    }
    
    
}

@@ -13,16 +13,88 @@
 599;%0D%0A%0D%0A
+import java.io.FileInputStream;%0D%0Aimport java.io.FileNotFoundException;%0D%0A
 import j
@@ -114,16 +114,16 @@
 yList;%0D%0A
-
 import j
@@ -202,16 +202,89 @@
 tor%0D%0A%7B%0D%0A
+    static int noOfMIMETypes=15;%0D%0A    static int charSetSize=256;%0D%0A    %0D%0A
     publ
@@ -869,10 +869,8 @@
 +%22%5D,
-%5Cn
 %22;%0D%0A
@@ -1310,17 +1310,292 @@
 %0D%0A    %0D%0A
-
     
+public static double%5B%5D%5B%5D getJSONFingerptint(String filePath) throws FileNotFoundException%0D%0A    %7B%0D%0A        double%5B%5D%5B%5D fingerprint=new double%5BnoOfMIMETypes%5D%5BcharSetSize%5D;%0D%0A        FileInputStream in = new FileInputStream(filePath);%0D%0A        %0D%0A        return fingerprint;%0D%0A    %7D
 %0D%0A%7D%0D%0A

change in JSONGenerator