How to Sort an Array in Java with Examples

In the tutorial, we will discuss how to Sort an Array with Java in ascending and descending order. java.util.Arrays class provides a lot of Methods to sort an Array with difference types:

  • With Primitives Array, We use the method such as: static void sort(int[] a).
  • With String or Objects Array that implement Comparable, We use method: static void sort(Object[] a).
  • With Custom Object Array that no implement Comparable, We use method: sort(T[] a, Comparator< ? super T> c).

Let’s do more details with Java Array Sorting.

[Continue reading…] “How to Sort an Array in Java with Examples”

Java – Convert Excel File to/from JSON (String/File) – using Apache Poi + Jackson

In the tutorial, Grokonez shows how to convert Excel File to JSON String or JSON File and vice versa with Java language by examples.

[Continue reading…] “Java – Convert Excel File to/from JSON (String/File) – using Apache Poi + Jackson”

Java – Convert CSV File to/from JSON (String/File) – using Commons-CSV + Jackson

In the tutorial, Grokonez shows how to convert CSV File to JSON String or JSON File and vice versa with Java language by examples.

[Continue reading…] “Java – Convert CSV File to/from JSON (String/File) – using Commons-CSV + Jackson”

Java 8 – Sort Map by Value, by Key – Sort Map Custom Object by CompareTo – Descending & Ascending Order

In the tutorial, we show how to sort Java Map by Values, by Keys, and Custom Objects with Descending & Ascending order in Java 8.

[Continue reading…] “Java 8 – Sort Map by Value, by Key – Sort Map Custom Object by CompareTo – Descending & Ascending Order”

How to Install Maven on Windows

In the tutorial, we show how to install Maven on Windows.

Environment:
– Windows 10
– Java 10
– Lastest Maven 3.5.4

Related posts:
Maven Introduction – Part 1
Maven Introduction – Part 2: Maven Repositories and Plugins
Part 3: Maven Dependency Mechanism
Maven Introduction – Part 4: Maven Build LifeCycle
Unit Test – Maven skip test with SpringBoot

[Continue reading…] “How to Install Maven on Windows”

Compress String with Run Length Encoding in Java

In this Java example, we’re gonna know how to compress String in Java with Run Length Encoding (RLE) method.

Related Posts:
Java Regular Expression Overview – Syntax
Java Regular Expression to extract data from a Text
Java Regular Expression to mask information from a Text

[Continue reading…] “Compress String with Run Length Encoding in Java”