Samual Sam has Published 2492 Articles

LocalDate format() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

72 Views

The LocalDate can be formatted with the specified formatter using the format() method in the LocalDate class in Java. This method requires a single parameter i.e. the LocalDate object to be formatted and it returns the formatted LocalDate with the specified formatter.A program that demonstrates this is given as follows ... Read More

How to use remove() in android CopyOnWriteArrayList?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

81 Views

Before getting into example, we should know what CopyOnWriteArrayList is. It is a thread-safe variant of ArrayList and operations add, set, and so on by making a fresh copy of the underlying array.This example demonstrate about How to use remove() in android CopyOnWriteArrayListStep 1 − Create a new project in ... Read More

Java Program to create random BigInteger within a given range

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

194 Views

Create a Random class object −Random random = new Random();Now let us create a random BigInteger within the range set below −BigInteger i = new BigInteger(1024, random);Example Live Demoimport java.math.BigInteger; import java.util.Random; public class Demo {    public static void main(String[] args) {       Random random = new Random(); ... Read More

DoubleBuffer wrap() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

72 Views

A double array can be wrapped into a buffer using the method wrap() in the class java.nio.DoubleBuffer. This method requires a single parameter i.e. the array to be wrapped into a buffer and it returns the new buffer created. If the returned buffer is modified, then the contents of the ... Read More

LocalDate getChronology() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

55 Views

The value of the specified field from the LocalDate can be obtained using the get() method in the LocalDate class in Java. This method requires a single parameter i.e. ChronoField that is required and it returns the value of the specified field from the LocalDate.A program that demonstrates this is ... Read More

Java Program to fill an array with random numbers

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

3K+ Views

Let us first crate an array −double[] arr = new double[5];Now, create Random class object −Random randNum = new Random();Now, fill the above array with random numbers −for (int i = 0; i < 5; i++) { arr[i] = randNum.nextInt(); }Example Live Demoimport java.util.Arrays; import java.util.Random; public class Demo {   ... Read More

LocalDateTime plusMonths() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

105 Views

An immutable copy of a LocalDateTime object where some months are added to it can be obtained using the plusMonths() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of months to be added and it returns the LocalDateTime object with the added ... Read More

DoubleBuffer hasArray() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

68 Views

It can be checked if a buffer has the backing of an accessible double array by using the method hasArray() in the class java.nio.DoubleBuffer. This method returns true if the buffer has the backing of an accessible double array and false otherwise.A program that demonstrates this is given as follows ... Read More

LocalDateTime plusDays() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

176 Views

An immutable copy of a LocalDateTime object where some days are added to it can be obtained using the plusDays() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of days to be added and it returns the LocalDateTime object with the added ... Read More

LocalDateTime range() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

130 Views

The range of values for a ChronoField can be obtained using the range() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the ChronoField for which the range of values is required and it returns the range of values.A program that demonstrates this is given ... Read More

Advertisements