Calculate fractions of positive, negative and zeros Find the fractions for, all positive numbers, all negative numbers and zeros in a given set of integer array.

I wrote the below program. If you see any improvements required, please feel free to point them out.

Sample input: 
6
-4 3 -9 0 4 1

Sample output:
0.500000
0.333333
0.166667


Here is my program :)

public class Solution {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int size = scan.nextInt();
        scan.nextLine();

        String s = scan.nextLine();
        List&lt;Double&gt; doubleList = Arrays.stream(s.split(" ")).mapToDouble(Double::valueOf).collect(ArrayList&lt;Double&gt;::new, List::add, List::addAll);

        int postive = 0;
        int negative = 0;
        int zeros = 0;
        double total = (int) doubleList.stream().count();

        DoublePredicate filterPositives = d -&gt; d &gt; 0;
        DoublePredicate filterNegatives = d -&gt; d &lt; 0;
        DoublePredicate filterZeros = d -&gt; d == 0;

        postive = countNumbers(doubleList.stream().mapToDouble(Double::valueOf), filterPositives);
        negative = countNumbers(doubleList.stream().mapToDouble(Double::valueOf), filterNegatives);
        zeros = countNumbers(doubleList.stream().mapToDouble(Double::valueOf), filterZeros);

        DecimalFormat df = new DecimalFormat("#.000000");
        System.out.println(df.format(postive/total));
        System.out.println(df.format(negative/total));
        System.out.println(df.format(zeros/total));
    }

    public static int countNumbers(DoubleStream ds, DoublePredicate fd){
        return (int) ds.filter(fd).count();
    }

}
Using the predicates in your case could be expensive for big list since you use 3 meaning 3 complete iteration on the list.

Here is a small update of you code (I can't use the Java 8 API since I only have the Java 6 at the office ...) to do the same check but without predicate (or if else)

    Scanner scan = new Scanner(System.in);
    int size = scan.nextInt();
    scan.nextLine();

    int[] sum = new int[3];

    String s = scan.nextLine();
    String[] array = s.split(" ");

    double total = array.length;
    for(String d : array ){ //Here, you shoud use your list instead of my array
        sum[Double.compare(Double.parseDouble(d), 0) + 1]++; 
        //compare will return -1 | 0 | 1, adding one to increment the correct cell in the array.
    }

    DecimalFormat df = new DecimalFormat("#.000000");
    System.out.println(df.format(sum[2]/total));
    System.out.println(df.format(sum[0]/total));
    System.out.println(df.format(sum[1]/total));


PS : I could update the code to match your List but to prevent any typo, I prefer to show you the logic I used with the API I can use.