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 Jun 2006

How do I convert decimal to binary?

In this example you will learn how to convert decimal number to binary number. To convert decimal number to binary we can use Integer.toBinaryString() method. This method takes a single parameter of integer and return a string that represent the equal binary number. If you want to convert the other way around, from binary string […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API19 Jun 2006

How do I get file size in Java?

This example will show you how to get the size of a file. To obtain the size of a file you can use the File‘s length() method. The length() method return the file size in bytes. package org.kodejava.io; import java.io.File; public class FileSize { public static void main(String[] args) { File file = new File("README.md"); […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API15 Jun 2006

How do I get file’s last modification date?

To get file last modification date we can use the lastModified() method of the File class. This method returns a long value. After getting this value you can create an instance of java.util.Date class and pass this value as the parameter. This Date will hold the file’s last modification date. package org.kodejava.io; import java.io.File; import […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API11 Jun 2006

How do I convert decimal to hexadecimal?

To convert decimal number (base 10) to hexadecimal number (base 16) we can use the Integer.toHexString() method. This method takes an integer as parameter and return a string that represent the number in hexadecimal. To convert back the number from hexadecimal to decimal number we can use the Integer.parseInt() method. This method takes two argument, […]

Wayan · 1 min read
AWT / NOTES</>↗
AWT10 Jun 2006

How do I read image file?

Here you see a code sample to read an image file. This code will work either the image file is located in a file folder or inside a jar file. You can use javax.imageio.ImageIO class to read the image file. package org.kodejava.awt; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; public class ReadingImage { public […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API09 Jun 2006

How do I get a localhost hostname?

package org.kodejava.network; import java.net.InetAddress; import java.net.UnknownHostException; public class HostNameExample { public static void main(String[] args) { try { InetAddress address = InetAddress.getLocalHost(); System.out.println("Hostname: " + address.getHostName()); } catch (UnknownHostException e) { e.printStackTrace(); } } } An example of output produce by the code snippet above is: Hostname: Krakatau

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.