Java Programming Tips


How to Zip a Folder in Java

Java has a good library of classes for handling zip files. These classes are available in the java.util.zip package. The following example program in Java shows how you can use java.util.zip classes to create a zip of an entire folder. We use the Files.walkFileTree to recursively navigate through the directory tree and then add each […]

Java Asymmetric Encryption Decryption Example with RSA

Asymmetric encryption is a strong encryption technique which uses a key pair. The key pair consists  of a public key and a private key. Data or message encrypted using the private key can only be decrypted using the public key and vice versa. Many internet protocols and secure processes use asymmetric key encryption. For example […]

How to Develop JavaFX Programs Using Eclipse and Gradle

JavaFX is an excellent framework for building cross platform rich client applications in Java. Since JDK 7, JavaFX is bundled with the JDK distribution. The latest version of the framework (JavaFX 8) is available as part of the Java 8 distribution. I recommend that you update your Java 8 installation to the latest version so […]

Pregnancy Due Date Calculator in Java

There are number of ways to calculate pregnancy due date. The most common way is to add 280 days to the first day of the last menstrual period. For example, if the first day of last menstrual period is 10th February 2017, the estimated delivery date is 17th November 2017. Note that pregnancy due dates […]

How to Create Checksum Value in Java

A checksum is a small sized data created from a larger data set using an algorithm. If there is even a single change in the larger data set, the algorithm will create a different checksum value. This property can be used to verify the integrity of data. For example, you can host a large download […]