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 API20 Mar 2010

How do I clear a buffer using compact() method?

If you want to clear a buffer, but you want to keep the unread data in the buffer then you need to use the compact() method of the buffer. The compact() method will copy the unread data to the beginning of the buffer and set the position right after the unread data. The limit itself […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API18 Mar 2010

How do I clear a buffer using clear() method?

The code below show you how to clear a buffer using the clear() method call. The clear method call set the position in the buffer to 0 and limit to the capacity of the buffer. We usually call the clear() method after we read the entire content of a buffer and clear it for ready […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API17 Mar 2010

How do I get signum function of a number?

The code below show you how to get the signum function of a number using the Math.signum() static method call. This method extracts the sign of a real number. If you have a number of x, the signum function of x is -1 if x < 0; 0 if x = 0 and 1 if […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API17 Mar 2010

How do I raised a number to the power of n?

The static method Math.pow(double a, double b) can be used to raise the value specified in the a, the first argument, (the base), to the power of the value specified in b, the second argument, (the exponent). The exponent tells us how many times the base should be multiplied by itself. So, if I have […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API17 Mar 2010

How do I calculate logarithm?

We can calculate logarithm using the Math.log10() and the Math.log() static method call. package org.kodejava.math; public class LogarithmExample { public static void main(String[] args) { double number1 = 1000.0d; // Get common logarithm double log10 = Math.log10(number1); System.out.println("Common logarithm of " + number1 + " = " + log10); // Get natural logarithm double loge […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API16 Mar 2010

How do I round a number?

The example below show you some methods of the Math class that can be used to round the value of a number. These methods are Math.ceil(), Math.floor() and Math.round(). package org.kodejava.math; public class GetRoundedValueExample { public static void main(String[] args) { Double number = 1.5D; // Get the smallest value that is greater than or […]

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.