Karthikeya Boyini has Published 2383 Articles

LocalDate get() method in Java

karthikeya Boyini

karthikeya Boyini

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

81 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

How to use remove() in android CopyOnWriteArraySet?

karthikeya Boyini

karthikeya Boyini

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

78 Views

Before getting into the example, we should know what CopyOnWriteArraySet 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 demonstrates about How to use remove () in android CopyOnWriteArraySetStep 1 − Create a new ... Read More

Java Program to shift array elements to the left

karthikeya Boyini

karthikeya Boyini

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

464 Views

Let us first create an int array −int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };Now, shift array elements to the left with arraycopy() and placing the elements correctly so that it gets shifted to the left −System.arraycopy(arr, 1, arr, 0, arr.length - 1);Example Live Demoimport ... Read More

DoubleBuffer arrayOffset() method in Java

karthikeya Boyini

karthikeya Boyini

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

54 Views

The offset of the first element of the buffer inside the buffer array is obtained using the method arrayOffset() in the class java.nio.DoubleBuffer. If the buffer backed by the array is read-only, then the ReadOnlyBufferException is thrown.A program that demonstrates this is given as follows −Example Live Demoimport java.nio.*; import java.util.*; ... Read More

LocalDateTime plusNanos() method in Java

karthikeya Boyini

karthikeya Boyini

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

107 Views

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

How to fill array values in Java?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

Let us first create an int array −int[] arr = new int[10];Now, fill array values. Here, the numbers get added from the index 2 to 7 −Arrays.fill(arr, 2, 7, 100);Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] args) {       int[] arr = new ... Read More

DoubleBuffer put() method in Java

karthikeya Boyini

karthikeya Boyini

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

65 Views

The required value can be written at the current position of the buffer and then the current position is incremented using the method put() in the class java.nio.DoubleBuffer. This method requires a single parameter i.e. the value to be written in the buffer and it returns the buffer in which ... Read More

LocalDateTime plusSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

83 Views

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

LocalDateTime until() Method in Java

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

The difference between two LocalDateTime objects can be obtained using the until() method in the LocalDateTime class in Java. This method requires two parameters i.e. the end date for the LocalDateTime object and the Temporal unit. Also, it returns the difference between two LocalDateTime objects in the Temporal unit specified.A ... Read More

Get the Average of Average in a single MySQL row?

karthikeya Boyini

karthikeya Boyini

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

191 Views

You can use aggregate function AVG() for this. Let us first create a table −mysql> create table DemoTable (    Value1 int,    Value2 int,    Value3 int ); Query OK, 0 rows affected (0.54 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(10, 20, 30); ... Read More

Advertisements