# Java Programming Examples on Arrays

Here is the listing of Java programming examples on Arrays.

## 1. Java Examples on Finding the Largest and Smallest Numbers in an Array

An array is a container object that holds a fixed number of values of a single type. The Java programs in this section to find the largest numbers, second largest number and smallest numbers in an given array.

Java Program to Find the Largest Two Numbers in a Given Array Java Program to Find the Second Largest & Smallest Elements in an Array Java Program to Find the Largest Number in an Array |

## 2. Java Examples on Inserting and Deleting Elements to and from an Array

The Java programs in this section deals with insertion and deletion of elements in an array. It has programs to insert a element in a specified position in a given array, delete the specified integer from an array, to insert even and odd elements of an array into two separate arrays and cyclically permute the elements of the given array.

Java Program to Put Even & Odd Elements of an Array in 2 Separate Arrays Java Program to Insert an Element in a Specified Position in a Given Array Java Program to Delete the Specified Integer from an Array Java Program to Cyclically Permute the Elements of an Array |

## 3. Java Examples on Sort and Merge Operations on an Array

Merge sort is a sorting technique based on divide and conquer technique. This section contains Java programs on sorting like sorting of an array in ascending and descending order, sorting the names in alphabetical order and splitting an array from the specified position.

## 4. Java Examples on Operations on Individual Elements of an Array

The Java programs in this section deals with the individual elements of an array. It has programs to find the number of elements in the given array, checking array bounds while inserting elements into an array, finding the odd elements of an array, finding the missing elements and non-repeating elements in an array, segregating 0s and 1s on the left and the right side of an array and finding the 2 elements of an array such that the difference between them is the largest.

## 5. Java Examples on Mathematical Functions and their Applications on Arrays

The Java programs in this section deals with various aspects of mathematical functions and their applications on Arrays. It has programs on mathematical and statistical functions like Floor and Ceiling functions, Union and Intersection operations, testing if the given integer X appears more than N/2 times in a sorted array of N integers, creating jagged array using 1d arrays.

Java Program to Find Union & Intersection of 2 Arrays Java Program to Find if a given Integer X Appears more than N/2 Times in a Sorted Array of N Integers Java Program to Accept the Marks of a Student into a 1D Array and find Total Marks and Percentage Java Program to Create a Jagged Array that Contains Two 1D Arrays Java Program to Find Ceiling & Floor of X given a Sorted Array & a Value X |

## 6. Java Examples on Printing the Elements of an Array

The Java programs in this section deals with programs to generate Pascal Triangle, printing all the repeated numbers with frequency in an array, printing the kth element in an array, printing the number of odd and even numbers in an array.

Java Program to Print the Odd & Even Numbers in an Array Java Program to Print the kth Element in the Array Java Program to Generate Pascal Triangle 1 D Array Java Program to Print All the Repeated Numbers with Frequency in an Array |

## 7. Java Examples on Search Operation on an Array

This section contains Java programs to find the biggest number in an an array using recursion and searching key elements in an array.

Java Program to Search Key Elements in an Array Java Program to Find the Biggest Number in an Array of Numbers Using Recursion |

## 8. Java Examples on Various Matrix Operations

Matrix is a rectangular arrangement of rows and columns. Triangular matrix is a kind of square matrix. A square matrix is called lower triangular if all the entries above the main diagonal are zero. A square matrix is called upper triangular if all the entries below the main diagonal are zero. Matrix that is both upper and lower triangular is called a diagonal matrix. Sparse matrix is a matrix in which most of the elements have a value of zero. This section contains Java programs to display transpose matrix, upper and lower triangular matrix, programs to find trace of a given matrix, add two m*n matrix from user input, performs matrix multiplication and checks whether given matrix is a sparse matrix or not.