AmitDiwan has Published 10744 Articles

Ints asList() function in Java

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:50:56

222 Views

The asList() method of the Ints class in Java Guava’s returns a fixed-size list backed by the specified array. The syntax is as follows −public static List    asList(int[] arr)Here, arr is the array to back the list.Let us see an example to implement the asList() method of the Ints ... Read More

Java lang Integer.toHexString() Method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:48:42

166 Views

The java.lang.Integer.toHexString() method returns a string representation of the integer argument as an unsigned integer in base 16.Let us now see an example −Exampleimport java.lang.*; public class Main {    public static void main(String[] args) {       int i = 160;       System.out.println("Number = " + ... Read More

Java signum() method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:46:47

183 Views

The java.lang.Math.signum(float f) returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.Let us now see an example −Exampleimport java.security.*; import java.util.*; public class Main {    public static void main(String[] ... Read More

Java Signature toString() method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:42:17

177 Views

The string representation for the signature object can be obtained using the method getString() in the class java.security.Signature. This includes information such as the object state, algorithm name etcLet us now see an example −Exampleimport java.security.*; import java.util.*; public class Main {    public static void main(String[] argv) {   ... Read More

Java Signature initSign() method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:40:30

455 Views

The initSign() method initialize this object for signing. If this method is called again with a different argument, it negates the effect of this call.Let us now see an example −Exampleimport java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.Signature; import java.util.Scanner; public class Main {    public static void main(String args[]) ... Read More

Java Signature getProvider() method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:38:17

177 Views

The provider for the signature object can be obtained using the method getProvider() in the class java.security.Signature.Let us now see an example −Exampleimport java.security.*; import java.util.*; public class Main {    public static void main(String[] argv) {       try {          Signature signature = Signature.getInstance("SHA256withRSA"); ... Read More

The abstract keyword in Java

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:35:35

418 Views

A class which contains the abstract keyword in its declaration is known as abstract class. Abstract classes may or may not contain abstract methods, i.e., methods without body. But, if a class has at least one abstract method, then the class must be declared abstract.If a class is declared abstract, it cannot be instantiated. To ... Read More

Traverse through a HashSet in Java

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:33:48

765 Views

HashSet extends AbstractSet and implements the Set interface. It creates a collection that uses a hash table for storage.A hash table stores information by using a mechanism called hashing. In hashing, the informational content of a key is used to determine a unique value, called its hash code.To traverse through a ... Read More

Java Signature getInstance() method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:31:24

692 Views

A signature object that can implement the required signature algorithm can be obtained using the method getInstance() in the class java.security.Signature.Let us now see an example −Exampleimport java.security.*; import java.util.*; public class Main {    public static void main(String[] argv) {       try {         ... Read More

Java Signature getAlgorithm() method with Examples

AmitDiwan

AmitDiwan

Updated on 23-Sep-2019 12:29:24

207 Views

The name of the algorithm for the signature object can be obtained using the method getAlgorithm() in the class java.security.Signature.Let us now see an example −Exampleimport java.security.*; import java.util.*; public class Main {    public static void main(String[] argv) {       try {          Signature ... Read More

Advertisements