Karthikeya Boyini has Published 2192 Articles

JavaTuples setAt1() method for Triplet class

karthikeya Boyini

karthikeya Boyini

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

96 Views

The setAt1() method is used to set the Triplet value in JavaTuples and a copy with a new value at the specified index i.e. index 1 here.Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following ... Read More

Java Program to get the value stored in a byte as an unsigned integer

karthikeya Boyini

karthikeya Boyini

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

291 Views

Let us first create signed byte −byte signedVal = -100;Now convert a byte to an unsigned integer −int unsignedVal = Byte.toUnsignedInt(signedVal);Examplepublic class Demo {    public static void main(String[] args) {       byte signedVal = -100;       int unsignedVal = Byte.toUnsignedInt(signedVal);       System.out.println("Signed value ... Read More

Is there a built-in function for week of the month in MySQL?

karthikeya Boyini

karthikeya Boyini

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

859 Views

There is no standard function to get week of month in MySQL. You need to use the following syntax −SELECT WEEK(yourDateColumnName, 5) - WEEK(DATE_SUB(yourDateColumnName, INTERVAL DAYOFMONTH(yourDateColumnName) - 1 DAY), 5) + 1 AS anyAliasName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a ... Read More

ShortBuffer asReadOnlyBuffer() method in Java

karthikeya Boyini

karthikeya Boyini

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

116 Views

A read-only short buffer can be created using the contents of a buffer with the method asReadOnlyBuffer() in the class java.nio.ShortBuffer. The new buffer cannot have any modifications as it is a read-only buffer. However, the capacity, positions, limits etc. of the new buffer are the same as the previous ... Read More

Clock tick() Method in Java

karthikeya Boyini

karthikeya Boyini

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

327 Views

The instant of the base clock can be rounded off for the required duration using the method tick() in the Clock Class in Java. This method requires two parameters i.e. the base clock and the duration of the tick. Also, the instant of the base clock rounded off for the ... Read More

Search a value in Java Unit Tuple

karthikeya Boyini

karthikeya Boyini

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

109 Views

To search a value in Unit class in JavaTuples, use the contains() method.Let us first see what we need to work with JavaTuples. To work with the Unit class in JavaTuples, you need to import the following package −import org.javatuples.Unit;Note − Steps to download and run JavaTuples program If you ... Read More

MySQL Order By date column and integer column, but specify ordering rules of integer column? Is it possible?

karthikeya Boyini

karthikeya Boyini

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

209 Views

You can achieve this with the help of ORDER BY CASE statement. The syntax is as follows −SELECT *FROM yourTableName ORDER BY CASE yourIntegerColumnName1 WHEN 2 THEN 1 ELSE 0 END DESC ,yourDateColumnName ASC;To understand the above syntax, let us create a table. The query to create a table is ... Read More

Clock tickSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

203 Views

The current ticking with the system clock in seconds can be obtained using the method tickSeconds() in the Clock Class in Java. This method requires a single parameter i.e. the time zone and it returns the current ticking value in seconds.A program that demonstrates this is given as follows −Example Live ... Read More

Iterate through Quintet class in Java Tuples

karthikeya Boyini

karthikeya Boyini

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

130 Views

You can iterate through Quintet class using a loop, like arrays in Java.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program If you are ... Read More

Java Program to get Temporal Queries precision

karthikeya Boyini

karthikeya Boyini

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

156 Views

To get Temporal Queries precision, use the TemporalQuery interface with the precision() method of the TemporalQueries −TemporalQueryprecision = TemporalQueries.precision(); Get the precision for LocalDate: LocalDate.now().query(precision) Get the precision for LocalTime: LocalTime.now().query(precision) Get the precision for YearMonth: YearMonth.now().query(precision) Get the precision for Year: Year.now().query(precision)Exampleimport java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Year; ... Read More

Advertisements