The Functional Interface is introduced in Java 8, and it is nothing but an interface with a Single Abstract Method (SAM). A functional interface can act as a target for a lambda expression or a method reference. … [Read more...]
Types of Exceptions in Java – Checked, Unchecked, & Error
In this article, we will learn about the different types of exceptions in Java checked exceptions, unchecked exceptions, and errors. … [Read more...]
Java ConcurrentHashMap | ConcurrentHashMap vs HashMap
ConcurrentHashMap is a class introduced in Java 1.5 Version which implements the ConcurrentMap interface. The ConcurrentHashMap is simply a concurrent version of the HashMap, the functionality is also similar to that of a HashMap except for the internal concurrency. In this article, we will get to know what is Java ConcurrentHashMap and it's usage, along with it we will also … [Read more...]
Difference between new operator vs newInstance() method in Java
In this article, we will learn the difference between new operator vs newInstance() method. In general, the new operator is used to create the object if you know the type of the object at the beginning itself, but if you don't know the type of the object at the beginning and if it is passed at the Runtime then we need to go with newInstance() method. … [Read more...]
5 Different Prime Number Program in Java | Prime Numbers between 1 to 100
What is a Prime Number? A Prime Number is a number which is greater than 1 and divisible by 1 and only itself. Some of the Prime Numbers are 2, 3, 5, 7, 11, 13, 17... In this Prime Number Program in Java, let's take a look into the different prime number programs. … [Read more...]
2 Different Magic Number in Java | Check whether a number is Magic Number or Not?
Before looking at the Magic number in Java, let's gets some basic understanding on a Magic number What is a Magic Number? A Magic Number is a text or numeric value which is used in the code which is used for some identification. Using such constant can help us distinguish the files among the many other file formats. … [Read more...]
6 Different Ways – Java Anagram Program | Check if Two Strings Are Anagram or Not?
What is an Anagram? An anagram is a word which is formed by rearranging or shuffling of letters in another word, the most important property in Anagram is that all the letters have to be used only once. For example, let's take the popular anagram, LISTEN is an anagram of SILENT. In this Anagram Program in Java, we will look into some the possible ways to check if two Strings … [Read more...]
Java AES 256 GCM Encryption and Decryption Example | JCE Unlimited Strength
Advanced Encryption Standard (AES) algorithm in Galois Counter Mode (GCM), known as AES-GCM. Advanced Encryption Standard with Galois Counter Mode (AES-GCM) is introduced by the National Institute for Standard and Technology (NIST). In this article, we will learn about Java AES 256 GCM Encryption and Decryption … [Read more...]
9 Different ways to Convert InputStream to String in Java?
Reading a file in Java is pretty simple, we simply can use FileInputStream to read the contents of a file, but if you want to do some operations on the content which is read such as validation, pattern matching, etc, then it would be easier to perform on the String rather than the InputStream. In this article, we will see the different ways to convert InputStream to String in … [Read more...]
Java ChaCha20 Poly1305 Encryption and Decryption Example
ChaCha20 Poly1305 is an AEAD [Authenticated Encryption with Additional Data] cipher.In the ChaCha20-Poly1305 algorithm, ChaCha20 Stream cipher performs the Encryption and Poly1305 performs the Authentication. ChaCha20 encrypts the data using Key and IV (Initialization Vector), Poly1305 will be used on the encrypted text, and a MAC [Message Authentication Code] is calculated … [Read more...]
Java ChaCha20 Encryption and Decryption Example | Symmetric Encryption
ChaCha20 is a stream cipher designed by Daniel J. Bernstein, ChaCha20 is a variant of the Salsa20 family of stream ciphers and widely used as an alternative to AES Encryption Algorithm. The 20 round stream cipher ChaCha20 is consistently faster and not sensitive to timing attacks as AES Algorithm. Java 11 has added support to ChaCha20 and ChaCha20 Poly1305 [AEAD] … [Read more...]
- Next Page »