import java.util.Arrays; public class App { public static void main(String[] args) { int[] arr = {1,5,-3,4,-9}; String text = ""; for (int i = 0; i < arr.length; i++) { if (arr>0){ text+=" "+arr; } else text+=arr; } int spaces = 0; for (char element : text.toCharArray()){ if (element == ) spaces++; } System.out.println(Arrays.toString(arr)); System.out.println("Количество пробелов ="+spaces); } }