About 174,000 results
Open links in new tab
  1. How can I get the size of an array, a Collection, or a String in Java ...

    May 19, 2014 · The array's length is available as a final instance variable length. An array initializer creates an array and provides initial values for all its components. Since the length of …

  2. arrays - length and length () in Java - Stack Overflow

    Dec 27, 2009 · In Java, an Array stores its length separately from the structure that actually holds the data. When you create an Array, you specify its length, and that becomes a defining …

  3. Getting the array length of a 2D array in Java - Stack Overflow

    In this case, we access [1, 1, 1, 1] and thus, the number of columns = 4. When you're given a problem where you can't see the array, you can visualize the array as a rectangle with n X m …

  4. How to find integer array size in java - Stack Overflow

    Mar 2, 2015 · Integer Array doesn't contain size() or length() method. Try the below code, it'll work. ArrayList contains size() method. String contains length(). Since you have used int …

  5. java - Length of byte [] array - Stack Overflow

    Mar 12, 2014 · The members of an array type are all of the following: The public final field length, which contains the number of components of the array. length may be positive or zero. length …

  6. Finding the size of a char array in Java - Stack Overflow

    Jul 30, 2012 · The above answers work. Also, if for some reason you need to know the array size before you actually create the array (for pre-processing or some such activity), you can get the …

  7. Multidimensional Arrays lengths in Java - Stack Overflow

    May 11, 2011 · In java we can define array of arrays which we call multi dimensional arrays.By array of arrays we mean that a single elment of our array is again an array (in java can be of …

  8. java - How to find the length of an array list? - Stack Overflow

    Mar 11, 2012 · I don't know how to find the length of an array list. I think you might need to use blank.length(); but I'm not sure. I made an array list. ArrayList<String> myList = new …

  9. java - Getting the length of two-dimensional array - Stack Overflow

    Expansion for multi-dimension array total length, Generally for your case, since the shape of the 2D array is "squared". int length = nir.length * nir[0].length; However, for 2D array, each row …

  10. java - Finding the longest string in an array of Strings - Stack …

    Apr 1, 2022 · You assign a variable for the length of the first array element: elementLength = array[0].length; and a value to keep track of the index You loop over the array You check …

Refresh