CORE API / CATATAN</>↗Core API05 Mar 2010
The number π is a mathematical constant, the ratio of a circle’s circumference to its diameter, commonly approximated as 3.14159. It has been represented by the Greek letter “π” since the mid-18th century, though it is also sometimes spelled out as “pi” (/paɪ/). From: Wikipedia The code snippet below show you how to obtain the […]
CORE API / CATATAN</>↗Core API02 Mar 2010
The code below show you how to use the Math.min() and Math.max() method call the get the minimum and maximum value between two numbers. As other method in the Math class these methods also overloaded to accept many types of primitive data. package org.kodejava.math; public class GetMinMaxValueExample { public static void main(String[] args) { Double […]
CORE API / CATATAN</>↗Core API25 Feb 2010
The example below show you how to get the absolute value of a number. To get the absolute value or the abs value of a number we use the Math.abs() method call. The Math.abs() method is an overloaded that can accept value in type of double, float, int or long. package org.kodejava.math; public class GetAbsoluteValueExample […]
CORE API / CATATAN</>↗Core API25 Feb 2010
In this example you’ll see how to read data from buffer using FileChannel.write() method call. Reading from a buffer means that you are writing data into the channel object. In the snippet below the data from our dummy buffer will be read and written into the result.txt file. package org.kodejava.io; import java.io.File; import java.io.FileOutputStream; import […]
CORE API / CATATAN</>↗Core API23 Feb 2010
A buffer can be read or written. To change the mode between the write mode and read mode we use the flip() method call on the buffer. There are few things that you should know when you change between the write mode to the read mode. A buffer have the capacity, position and limit properties. […]
CORE API / CATATAN</>↗Core API22 Feb 2010
The snippet below show you how to write some bytes into the java.nio.ByteBuffer object through a call to the put() method. package org.kodejava.io; import java.nio.ByteBuffer; public class BufferPut { public static void main(String[] args) { ByteBuffer buffer = ByteBuffer.allocate(32); buffer.put((byte) 65); buffer.put((byte) 66); buffer.put((byte) 67); buffer.put((byte) 68); buffer.put((byte) 69); // Writes a sequence of bytes […]