Java Array

Java Array

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Array

Java provides a data structure know as the array type. This is a basic data structure which is used as the basis of other data structures. The array type has some good performance characteristics for some operations and not so good performance for other behaviors.

Read More

Java Array Performance

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Array Performance

In previous sections we described what an array is in java. If we recall an array has a type, and every element in a java array has the same type. So every element in an array is of a certain type, but an array also has a length. In this sense if we have an array that has a length of five and has a type of integer we say that we have a fixed size array of five integers. Moreover, this array is five continuous memory address, that we can access individually using an index.

Read More

Java Reverse Array

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Reverse Array

Having previously talked about what an array is and some of the performance characteristics of a java array. Let's look at an example of how to reverse a java array. To reverse an array in java we will write some code. Since we haven't discussed methods, generics etc in great detail we will keep the code as simple as possible.

Read More

Java Sum Array

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Sum Array

Having previously talked about what an array is and some of the performance characteristics of a java array. Let's look at an example of how to sum the elements of a java array. To sum a java array in java we will write some code. Since we haven't discussed more advanced java language features such as generics etc in great detail we will keep the code as simple as possible.

Read More

Java Array: ToString Example

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Array: ToString Example

Here we will show an example of how to convert a java int array into a String. In this example we will convert a java array to a String. The toString method is inherited by every java object, as it is a method of the java.lang.Object super Object. We will talk more about this method later.

Read More

Java Array: Find Mean

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Array: Find Mean

Here we will show an example of how to find the mean of a java integer array. The mean of an array is simply the average value of its sum. We sum up all the values of the array and divide it by the length of the java array.

Read More

Java Array: How To Join An Array

By: Stephen Patrick | 26 May 2016 | Category: Java Array

Java Array: How To Join An Array

Having previously talked about what an array is. Let's look at an example of how to join the elements of an array together. Joining the elements of a java array and returning it as a java.lang.String is a very common operation. Sometimes, we need to split a string into it's constituent parts, performing an operation on those parts, and put those parts back together to form the original String.

Read More

Java Array: Find Min Value

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Array: Find Min Value

Here we will show an example of how to find the minimum value of a java integer array. The min value of an array is simply the smallest value the java array contains. If the java array has a length of 0 then the min value of the java array will be 0. Lets write some code to find the min value of the java array.

Read More

Java Array: Find Max Value

By: Stephen Patrick | 25 May 2016 | Category: Java Array

Java Array: Find Max Value

Here we will show an example of how to find the maximum value of a java integer array. The max value of an array is simply the largest value the java array contains.

Read More