SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API07 Apr 2006

How do I sort an array of objects?

In this example we are going to learn how to sort an array of objects. We start by using an array of String objects as can be seen in the code snippet below. We sort the contents of the array using Arrays.sort() method and print the sorted result. It was really simple. String names[] = […]

Wayan · 3 min read
CORE API / NOTES</>↗
Core API04 Apr 2006

How do I search specific value in an array?

package org.kodejava.util; import java.util.Arrays; public class ArraySearchExample { public static void main(String[] args) { // We create an array of ints where the search will be done. int[] items = {9, 5, 14, 6, 11, 28, 9, 16, 37, 3, 2}; // The Arrays.binarySearch() require us to sort the array // items before we call […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API02 Apr 2006

How do I sort elements of an array?

package org.kodejava.util; import java.util.Arrays; public class ArraySortExample { public static void main(String[] args) { // An array of random numbers int[] numbers = {3, 1, 8, 34, 1, 2, 13, 89, 5, 21, 55}; System.out.println("Before: " + Arrays.toString(numbers)); // We need to sort these array elements into a correct order // from the smallest to […]

Wayan · 1 min read
APACHE COMMONS / NOTES</>↗
Apache Commons01 Apr 2006

How do I convert an array of primitives into an array of objects?

To convert from primitive arrays into object type arrays, we can use the Apache Commons Lang library. The Commons Lang provides an ArrayUtils class that does this conversion. To convert the other way just use the toPrimitive() method. package org.kodejava.commons.lang; import org.apache.commons.lang3.ArrayUtils; public class ArrayPrimitiveObjectConversionDemo { public static void main(String[] args) { int[] numbers = […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API28 Mar 2006

How do I check if a file exists?

To check if a file, or a directory exists we can utilize java.io.File.exists() method. This method return either true or false. Before we can check whether its exists or not we need to create an instance of File that represent an abstract path name of the file or directory. After we have the File instance […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API23 Mar 2006

How do I copy some items of an array into another array?

In the code snippet below we are going to learn how to use the System.arraycopy() method to copy array values. This method will copy array from the specified source array, starting from the element specified by starting position. The array values will be copied to the target array, placed at the specified start position in […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.