import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
import com.google.gson.Gson;


class {class_name} {{

    private class Classifier {{
        private double[] coefficients;
        private double intercepts;
    }}

    private Classifier clf;

    public {class_name}(String file) throws FileNotFoundException {{
        String jsonStr = new Scanner(new File(file)).useDelimiter("\\Z").next();
        this.clf = new Gson().fromJson(jsonStr, Classifier.class);
    }}

    public int {method_name}(double[] features) {{
        double prob = 0.;
        for (int i = 0, il = this.clf.coefficients.length; i < il; i++) {{
            prob += this.clf.coefficients[i] * features[i];
        }}
        if (prob + this.clf.intercepts > 0) {{
            return 1;
        }}
        return 0;
    }}

    public static void main(String[] args) throws FileNotFoundException {{
        if (args.length > 0 && args[0].endsWith(".json")) {{

            // Features:
            double[] features = new double[args.length-1];
            for (int i = 1, l = args.length; i < l; i++) {{
                features[i - 1] = Double.parseDouble(args[i]);
            }}

            // Parameters:
            String modelData = args[0];

            // Estimators:
            {class_name} clf = new {class_name}(modelData);

            // Prediction:
            int prediction = clf.{method_name}(features);
            System.out.println(prediction);

        }}
    }}
}}