About 507,000 results
Open links in new tab
  1. How do I declare and initialize an array in Java?

    Jul 29, 2009 · This answer fails to properly address the question: "How do I declare and initialize an array in Java?" Other answers here show that it is simple to initialize float and int arrays …

  2. java - Convert an integer to an array of digits - Stack Overflow

    First take input from the user as int, convert it into String, and make a character array of size of str.length(). Now populate a character array with a for loop using charAt().

  3. java - Adding integers to an int array - Stack Overflow

    I am trying to add integers into an int array, but Eclipse says: cannot invoke add(int) on the array type int[] Which is completely illogical to me. I also tried addElement() and addInt(), however

  4. java - How to convert an ArrayList containing Integers to primitive …

    Apr 5, 2009 · What it does is: getting a Stream<Integer> from the list obtaining an IntStream by mapping each element to itself (identity function), unboxing the int value hold by each Integer …

  5. How to convert int[] into List<Integer> in Java? - Stack Overflow

    Jul 2, 2009 · How do I convert int[] into List<Integer> in Java? Of course, I'm interested in any other answer than doing it in a loop, item by item. But if there's no other answer, I'll pick that …

  6. Finding the max/min value in an array of primitives using Java

    Sep 28, 2009 · If you have an array of one of those, you can find the min or max using Arrays.stream(). A comprehensive solution to the problem of reductions over primitive arrays is …

  7. How to make an array of integer arrays in Java? - Stack Overflow

    Mar 6, 2019 · I have been trying to make an array of integer arrays. I know that the outer array will have length N whilst every integer array within in only needs to hold two values. Originally, I …

  8. How can I convert a Java HashSet<Integer> to a primitive int array?

    There is an unnecessary Integer[] that slows down the process of creating a primitive array from a collection. Actually, I think the choice to use Integer[] as parameter for toPrimitive(..) instead of …

  9. How can I convert int[] to Integer[] in Java? - Stack Overflow

    Presumably you want the key to the map to match on the value of the elements instead of the identity of the array. In that case you want some kind of object that defines equals and …

  10. arrays - Java ArrayList for integers - Stack Overflow

    Jan 20, 2013 · With your declaration JVM will create a ArrayList of integer arrays i.e each entry in arraylist correspond to an integer array hence your add function should pass a integer array as …