APACHE COMMONS / CATATAN</>↗Apache Commons05 Mei 2006
In this example we use FileUtils class from Apache Commons IO to read the content of a file. FileUtils have two static methods called readFileToString(File) and readFileToString(File, String) that we can use. An example to read file contents and return the result as a string can be seen below. package org.kodejava.commons.io; import org.apache.commons.io.FileUtils; import java.io.File; […]
APACHE COMMONS / CATATAN</>↗Apache Commons01 Apr 2006
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 = […]
APACHE COMMONS / CATATAN</>↗Apache Commons17 Mar 2006
The toString() method defined in the java.lang.Object can be overridden when we want to give more meaningful information about our object. We can simply return any information of the object in the toString() method, for instance the value of object’s states or fields. The Apache Commons Lang library offers a good utility for creating this […]