Karthikeya Boyini has Published 2193 Articles

LocalDateTime getSecond() method in Java

karthikeya Boyini

karthikeya Boyini

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

80 Views

The second of minute for a particular LocalDateTime can be obtained using the getSecond() method in the LocalDateTime class in Java. This method requires no parameters and it returns the second of the minute in the range of 0 to 59.A program that demonstrates this is given as follows −Example Live ... Read More

JavaTuples setAt1() method for Triplet class

karthikeya Boyini

karthikeya Boyini

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

84 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

279 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

845 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

106 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

314 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

102 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

201 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

189 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

123 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

Advertisements