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.

SERVLET / NOTES</>↗
Servlet23 Nov 2006

How do I create a HelloWorld Servlet?

Servlet is a Java solution for creating a dynamic web application, it can be compared with the old CGI technology. Using Servlet we can create a web application that can display information from a database, receive information from a web form to be stored in the application database. This example shows the very basic of […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API19 Nov 2006

How do I shuffle elements of an array?

package org.kodejava.util; import java.util.Arrays; import java.util.Collections; import java.util.List; public class ArrayShuffle { public static void main(String[] args) { // Initialize the contents of our array String[] alphabets = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"}; // As the Collections.shuffle() method need a list for the parameter // we convert our array into […]

Wayan · 1 min read
SECURITY / NOTES</>↗
Security14 Nov 2006

How do I create an encrypted string for a password?

You are creating a user management system that will keep user profile and their credential or password. For security reason you’ll need to protect the password, to do this you can use the MessageDigest provided by Java API to encrypt the password. The code example below show you an example how to use it. package […]

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

How do I use for-each in Java?

Using for-each command to iterate arrays or a list can simplified our code. Below is an example how to do it in Java. The first loop is for iterating array and the second for iterating a list containing a some names. package org.kodejava.lang; import java.util.ArrayList; import java.util.List; public class ForEachExample { public static void main(String[] […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API05 Nov 2006

How do I convert string to an integer or number?

package org.kodejava.lang; public class StringToInteger { public static void main(String[] args) { // Some random selected number, could representing a decimal, // hexadecimal or octal number. String myLuckyNumber = "13"; // We convert a string to an integer by invoking parseInt() method // of the Integer class. int number = Integer.parseInt(myLuckyNumber); System.out.println("My lucky number is: […]

Wayan · 1 min read
ZIP AND GZIP / NOTES</>↗
Zip and GZIP03 Nov 2006

How do I create a zip file?

package org.kodejava.util.zip; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class ZippingFileExample { public static void main(String[] args) { String source = "data.txt"; String target = "data.zip"; try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(target)); InputStream is = ZippingFileExample.class.getResourceAsStream("/" + source)) { if...

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.