Core Java
-
Convert String to byte array ASCII encoding
This is an example of how to convert a String to byte array with ASCII encoding. The String class represents…
Read More » -
Convert String to byte array UTF encoding
public static byte[] stringToBytesUTFCustom(String str) { byte[] b = new byte[str.length() << 1]; for(int i = 0; i < str.length();…
Read More » -
Code injection with Java Proxy example
I was using JDBC PreparedStatement’s batch updates to modify a lot of data in a database and the processing was…
Read More » -
MethodHandle example
public class MethodAccessExampleWithArgs { private final int i; public MethodAccessExampleWithArgs(int i_) { i = i_; } private void bar(int j,…
Read More » -
Generate random Integer within given range
In this example we shall show you how to generate a random Integer within a given range, using random() method…
Read More » -
Find floor value of a number
With this example we are going to demonstrate how to find the floor value of a number, using the floor(double…
Read More » -
Find natural logarithm value of a number
This is an example of how to find the natural logarithm value of a number, using the log(double a) method…
Read More » -
Find ceiling value of a number
In this example we shall show you how to find the ceiling value of a number, using the Math Class.…
Read More » -
Round float and double numbers
With this example we are going to demonstrate how to round float and double numbers using round() method of Math.…
Read More » -
Java BigDecimal Example
In this article we will learn about a primitive data type in java the BigDecimal class in java. We will…
Read More »