Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
HowToDoInJava
  • Java
  • Spring AI
  • Spring Boot
  • Hibernate
  • JUnit 5
  • Interview

Java Array

Arrays in Java, conceptually, are no different than in other programming languages. The java.util.Arrays class provides many useful static methods to work with arrays and perform common operations on them. 1. Array Basics 2. Array Operations 3. Searching and Sorting 4. Conversions 5. Advance Topics Happy Learning !! …

Lokesh Gupta

August 15, 2024

Java Array, Series
Series
Guides

Arrays in Java, conceptually, are no different than in other programming languages.

  • Arrays are contiguous memory locations storing only one type of item in a sequence.
  • Arrays provide index-based access i.e. the first element of the array is stored at the 0th index, 2nd element is stored on 1st index and so on.
  • Note that, in Java, arrays are also objects that inherit the Object class, and implement the Serializable as well as Cloneable interfaces.
  • We can store all kinds of primitive values or objects in an array.
  • Java supports single dimentional or multi-dimentional arrays, both. 

The java.util.Arrays class provides many useful static methods to work with arrays and perform common operations on them.

1. Array Basics

  • Intro to Java Arrays
  • Initialize an Array
  • Reverse an Array
  • Comparing Two Arrays
  • ArrayStoreException
  • Printing an Array
  • Printing 2D Array

2. Array Operations

  • Concatenate Two Arrays in Java
  • Splitting an Array
  • Joining Array Items with Seperator
  • Resizing an Array
  • Removing Items from Array
  • Remove Duplicates from Array
  • Union of Two Arrays
  • Intersection of Two Arrays

3. Searching and Sorting

  • How to Check is Array Contains an Item
  • Find Top N items in Array
  • Find Sum and Average of Array
  • Find Max/Min in Array
  • Sorting an Array
  • Checking if array is already sorted?

4. Conversions

  • Array of Primitives to Array to objects
  • Convert between Array and List
  • Convert between Stream and Array
  • Java String to String Array
  • Convert String[] to Integer[]

5. Advance Topics

  • Java Array Clone
  • Java Array Copy
  • Java Array Deep Copy
  • Java Copy Array Range

Happy Learning !!

Sourcecode on Github

Java Array

  • Array Print
  • Array Copy
  • Array Clone
  • Array Union
  • Array Intersection
  • Remove Duplicates
  • String to String[]
  • String to byte[]

Table of Contents

  • 1. Array Basics
  • 2. Array Operations
  • 3. Searching and Sorting
  • 4. Conversions
  • 5. Advance Topics
Photo of author

Lokesh Gupta

A fun-loving family man, passionate about computers and problem-solving, with over 15 years of experience in Java and related technologies. An avid Sci-Fi movie enthusiast and a fan of Christopher Nolan and Quentin Tarantino.
Follow on Twitter Portfolio

Previous

Java ArrayStoreException and How to resolve it?

Next

Java 8 Date Time API

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.

Tutorial Series

OOP

Regex

Maven

Logging

TypeScript

Python

Meta Links

About Us

Advertise

Contact Us

Privacy Policy

Our Blogs

REST API Tutorial

Follow On:

  • Github
  • LinkedIn
  • Twitter
  • Facebook
Copyright © 2026 | Sitemap