We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Can you help me I don't understand where is the problem in my code
the output is wrong ,I always recieve Zero even if im trying to write 3 / 6 and Math.floorDiv
This is my Code and tank you
public static void plusMinus(List arr) {
// Write your code here
int sizeList =arr.size();
long countPositive=0;
long countNegative=0;
long countZero=0;
countPositive =arr.stream().filter(e->e>0).count();
System.out.println(Math.floorDiv(3, 6));
// System.out.printf("%f%n",countPositive/ sizeList);
Plus Minus
You are viewing a single comment's thread. Return to all comments →
Hello All,
Can you help me I don't understand where is the problem in my code the output is wrong ,I always recieve Zero even if im trying to write 3 / 6 and Math.floorDiv
This is my Code and tank you public static void plusMinus(List arr) { // Write your code here int sizeList =arr.size(); long countPositive=0; long countNegative=0; long countZero=0; countPositive =arr.stream().filter(e->e>0).count(); System.out.println(Math.floorDiv(3, 6)); // System.out.printf("%f%n",countPositive/ sizeList);
countNegative =arr.stream().filter(e->e<0).count(); countZero =arr.stream().filter(e->e==0).count(); System.out.println(Math.floorDiv(countNegative, sizeList)); System.out.println(Math.floorDiv(countZero, sizeList)); System.out.println(countPositive ); System.out.println(countNegative ); System.out.println(countZero );