AmitDiwan has Published 11365 Articles

Stream sorted() in Java

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:44:05

352 Views

The Stream sorted() in Java returns a stream consisting of the elements of this stream, sorted according to natural order.Following is the syntax −Stream sorted()Here, Stream is an interface in java.util.stream and is the type parameter in stream. This method returns the new stream.Following is an example to implement ... Read More

Java floor() method with Examples

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:42:09

158 Views

The java.lang.Math.floor() returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. Special cases −If the argument value is already equal to a mathematical integer, then the result is the same as the argument.If the argument is ... Read More

Java sqrt() method with Examples

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:38:10

183 Views

The java.lang.Math.sqrt(double a) returns the correctly rounded positive square root of a double value. Special cases −If the argument is NaN or less than zero, then the result is NaN.If the argument is positive infinity, then the result is positive infinity.If the argument is positive zero or negative zero, then the result ... Read More

How to Clone a Map in Java

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:35:09

364 Views

The java.util.HashMap class is the Hash table based implementation of the Map interface. To clone a Map in Java, use the clone() method.ExampleLet us see an example to clone a Map −import java.util.*; public class HashMapDemo {    public static void main(String args[]) {       // create two hash maps ... Read More

How to Clone a List in Java?

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:34:05

319 Views

To clone a list in Java, the easiest way is using the ArrayList.clone() method −Exampleimport java.util.ArrayList; public class Demo {    public static void main(String args[]) {       // create an empty array list       ArrayList arrlist1 = new ArrayList();       // use add ... Read More

Ints Class in Java

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:31:11

244 Views

The Ints class is a utility class for primitive type int. Let us see the class declaration −@GwtCompatible public final class Ints extends ObjectExampleLet us see an example of one of the methods to perform concatenation. The concat() function in Ints class is used to concatenate the arrays passed as ... Read More

Java cbrt() method with Examples

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:26:01

99 Views

The java.lang.Math.cbrt(double a) returns the cube root of a double value. For positive finite x, cbrt(-x) == -cbrt(x); that is, the cube root of a negative value is the negative of the cube root of that value's magnitude. Special cases −If the argument is NaN, then the result is NaN.If the argument ... Read More

Java log1p() with example

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:23:44

79 Views

The java.lang.Math.log1p(double x) returns the natural logarithm of the sum of the argument and 1. Note that for small values x, the result of log1p(x) is much closer to the true result of ln(1 + x) than the floating-point evaluation of log(1.0+x).Special cases −If the argument is NaN or less than -1, ... Read More

Java log10() with example

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:15:47

97 Views

The java.lang.Math.log10(double a) returns the base 10 logarithm of a double value. Special cases −If the argument is NaN or less than zero, then the result is NaN.If the argument is positive infinity, then the result is positive infinity.If the argument is positive zero or negative zero, then the result is negative ... Read More

Java lang.Long.toBinaryString() method with Examples

AmitDiwan

AmitDiwan

Updated on 24-Sep-2019 08:14:11

83 Views

The java.lang.Long.toBinaryString() method returns a string representation of the long argument as an unsigned integer in base 2.ExampleFollowing is an example to implement the toBinaryString() method −import java.lang.*; public class Demo {    public static void main(String[] args) {       long l = 190;       System.out.println("Number ... Read More

Advertisements