How-to articles, tricks, and solutions about JAVA
Converting double to integer in Java
To convert a double to an int in Java, you can use the intValue() method of the Double class.
How do you know a variable type in java?
You can use the instanceof operator to determine the type of a variable in Java.
How to create a sub array from another array in Java?
There are a few different ways to create a subarray from another array in Java:
How to mock a final class with mockito
To mock a final class with Mockito, you can use the PowerMockito library.
Simple HTTP server in Java using only Java SE API
To create a simple HTTP server in Java using only the Java SE API, you can use the java.net package.
How to return multiple values?
There are a few different ways to return multiple values from a method in Java:
Converting JSON data to Java object
To convert JSON data to a Java object, you can use the fromJson method of the Gson class.
How to format decimals in a currency format?
You can use the NumberFormat class to format decimals in a currency format.
Converting characters to integers in Java
There are a few ways to convert a character to an integer in Java.