How to convert String to Int in Java ?

How to convert String to Int in Java ?
DeeKay January 20, 2017 at 3:25 am · JAVA API

To convert String to Int in Java, you can use the below methods of Integer class. Methods to convert String to Int 1) Integer.parseInt() code example /** * Created on Nov 19, 2016 Copyright(c) https://kodehelp.com All Rights Reserved. */ package com.kodehelp.java.lang; /** * @author https://kodehelp.com */ public class ConvertStringToInt { public static void main(String args[]){…
Continue Reading »


How to generate pseudorandom numbers in Java ?

How to generate pseudorandom numbers in Java ?
DeeKay January 3, 2017 at 8:45 pm · How To, java.math, java.util, Other

In this post we will see how to generate pseudorandom numbers in Java. Before that we will see what is Random numbers. Random numbers are the numbers that occur in sequence such that the values are uniformly distributed over a defined interval or set, which is impossible to predict future values based on present and…
Continue Reading »


Java 8 – How to find Date on the day of given Week in a month ?

Java 8 – How to find Date on the day of given Week in a month ?
DeeKay December 6, 2016 at 9:17 pm · java.time

In this Java 8 program we will see how to find date on the day of given week in a month. For example if we want to find the date on 3rd Wednesday of current month.  


What is the difference between HashTable and HashMap in Java?

What is the difference between HashTable and HashMap in Java?
DeeKay December 2, 2016 at 3:12 am · java.util

Both HashTable and HashMap are java collections and implements java.util.Map interface. Difference between HashTable and HashMap is the most common interview question. Many of the candidates who face the interview struggle to answer this question. Difference between HashTable and HashMap in Java Thread Safe: HashTable is thread-safe and can be shared between multiple threads but…
Continue Reading »


How to Sort a Map by key in Java?

How to Sort a Map by key in Java?
DeeKay November 20, 2016 at 2:00 am · java.util, sorting

Here we will see how to sort a Map by key in java. There are two ways to sort a Map by Key –   First Approach Second Approach


How to write Bubble Sort in Java ?

How to write Bubble Sort in Java ?
DeeKay September 16, 2014 at 12:58 am · JAVA API, sorting

We all have learnt sorting techniques in our college academic curriculum. Out of those sorting techniques the simplest technique we learnt is Bubble Sort Implementation in Java. The Bubble sort takes an array of numbers and sort them within the array indexes in either ascending or descending order. Bubble sort is simplest of all sorting…
Continue Reading »


How To Send a Plain Text EMail in Java using JavaMail API ?

How To Send a Plain Text EMail in Java using JavaMail API ?
DeeKay May 5, 2014 at 12:28 am · javax.mail

Java Mail API is used to create your own email client. This class provides the code required to model your email client similar to Outlook, Hotmail and many others. In JavaMail you’ll find APIs and provider implementations allowing you to develop fully functional email client applications. Below java program shows you how to send a plain text…
Continue Reading »


How to use Preferences API to store application/Program configurations ?

How to use Preferences API to store application/Program configurations ?
DeeKay October 16, 2013 at 3:32 am · java.util

Introduction Preferences (Java.util.pref) API is included in JDK can be used to remember and retrieve application preferences. Using this API you can manage preference data such as storing, retrieving, removing and cleaning preference data. This API is not intended to save application data. Also it reduces the burden of application developer to write the code…
Continue Reading »


How to Use File Separator to construct file path in java?

How to Use File Separator to construct file path in java?
DeeKay June 10, 2012 at 11:52 pm · java.io

Many java developers might have came across the code where the developer need to use file separator for the file path or directory path. Many of them are using “/” or “\” depending upon the operating system. Using the forward or backward slash is not a good practice while coding in the java, because your code may…
Continue Reading »


How to Read UTF-8 Data From a File Using Java ?

How to Read UTF-8 Data From a File Using Java ?
DeeKay June 10, 2012 at 11:08 pm · java.io

Below Java Code shows how to read UTF-8 encoded data from a text file –