How to Get Current Date and Current Time

If you are working on Java 8, it is recommended to use java.time package. If you are using prior to Java 8, it is often recommended to go for Joda API. In this post, we will discuss on how to get current date and current time using java.time package. To obtain current date from system … Read more

How to convert char array to String

String(char[]) String class accepts char array in its constructor and converts it into string. Output String.valueOf(char[]) String class provides valueOf method which accepts char array and returns a String object. StringBuilder.append(char[]) StringBuilder class provides an append method that can accept a char array. This method reads all characters and appends them to the buffer. We … Read more

How to Convert char to String

String and Character classes from java.lang package provide methods to convert a primitive character to String. String.valueOf(char) Character.toString(char)

String to Integer Conversion

If you want to utilize a number in calculations which you have received as string, it might create some unexpected issues. For example, below program simply appends two numbers instead of performing addition. Integer.parseInt(String) Package java.lang provides a wrapper class called as Integer which has parseInt method that can convert string to signed decimal integer. … Read more