SupportWriter space ↗
A JOURNAL ABOUT TECHNOLOGY

Learn something new.
Write. Share.

A space to connect knowledge, one line of code a day.
Discover tutorials, ideas, and notes from a learning journey.

1967 notes & counting ↙
FOR YOUR CURIOSITY

Latest notes.

APACHE COMMONS / NOTES</>↗
Apache Commons14 Jul 2007

How do I convert an array of object to an array of primitive?

In the code example below we demonstrate the ArrayUtils.toPrimitive() method to convert an array of Integer object to an array of its primitive type. Besides converting an array of Integer objects, this method is overloaded to accept other types of object’s array. package org.kodejava.commons.lang; import org.apache.commons.lang3.ArrayUtils; public class ArrayObjectToPrimitiveDemo { public static void main(String[] args) […]

Wayan · 1 min read
APACHE COMMONS / NOTES</>↗
Apache Commons11 Jul 2007

How do I convert an array to a Map?

This example uses the Apache Commons Lang’s ArrayUtils.toMap() method to convert a two-dimensional array into a Map object. To convert a two-dimensional array into a Map object, each element of the two-dimensional array must be an array with at least two elements where the first element will be the key and the second element will […]

Wayan · 2 min read
APACHE COMMONS / NOTES</>↗
Apache Commons09 Jul 2007

How do I reverse array elements order?

In this example we are going to use the ArraysUtils helper class from the Apache Commons Lang library to reverse the order of array elements. The method to reverse the order of array elements is ArrayUtils.reverse() method. The ArrayUtils.reverse() method is overloaded, so we can reverse another type of array such as java.lang.Object, long, int, […]

Wayan · 1 min read
APACHE COMMONS / NOTES</>↗
Apache Commons28 Aug 2006

How do I create a copy of a file?

This example shows how we can use the Apache Commons IO library to simplify a file copy process. package org.kodejava.commons.io; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; public class FileCopyExample { public static void main(String[] args) { // The source file name to be copied. File source = new File("README.md"); // The target file name to […]

Wayan · 2 min read
APACHE COMMONS / NOTES</>↗
Apache Commons13 Aug 2006

How do I count word occurrences in a string?

package org.kodejava.commons.lang; import org.apache.commons.lang3.StringUtils; public class WordCountDemo { public static void main(String[] args) { // We have the source text we'll do the search on. String source = "From the download page, you can download the Java " + "Tutorials for browsing offline. Or you can just download " + "the example."; // The word […]

Wayan · 1 min read
APACHE COMMONS / NOTES</>↗
Apache Commons09 Aug 2006

How do I reverse a string, words or sentences?

package org.kodejava.commons.lang; import org.apache.commons.lang3.StringUtils; public class StringReverseDemo { public static void main(String[] args) { // We have an original string here that we'll need to reverse. String words = "The quick brown fox jumps over the lazy dog"; // Using StringUtils.reverse we can reverse the string letter by letter. String reversed = StringUtils.reverse(words); // Now […]

Wayan · 1 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.