---
title: "Discussion on \"Java DSA cheatsheet\" | Hashnode"
description: "Discussion on \"Java DSA cheatsheet\". Data Structures\n1. Arrays\nint[] arr = new int[10];\narr[1] = 34;\narr[1] = 35;\n\nint i = arr[1];\nint size = arr.length;\n\n// Fill array with a value\nArrays.fill(arr, -1);\n\n// Sort\nArrays.sort(arr); // Ascending\nArrays.sort(arr, (a, b) -> b - a); // Desce..."
url: "https://hashnode.com/posts/java-cheatsheet/682833c02a102009f8841cd3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Java DSA cheatsheet](https://arpitrathore.com/java-cheatsheet?utm_source=hashnode&utm_medium=feed)

Data Structures 1. Arrays int\[\] arr = new int\[10\]; arr\[1\] = 34; arr\[1\] = 35; int i = arr\[1\]; int size = arr.length; // Fill array with a value Arrays.fill(arr, -1); // Sort Arrays.sort(arr); // Ascending Arrays.sort(arr, (a, b) -> b - a); // Desce...

May 17, 2025 · 3 min read · arpitrathore.com  
Updated Jun 30, 2025  
Read the article

-   [#dsa](https://hashnode.com/tag/dsa)
-   [#collection-framework](https://hashnode.com/tag/collection-framework)

## Written by

[Arpit Rathore](https://hashnode.com/@arpitrathore)

@arpitrathore · Pune, India

  
[View profile](https://hashnode.com/@arpitrathore)

Staff Engineer

Staff Engineer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
