Arjun Thakur has Published 1025 Articles

Convert array to generic list with Java Reflections

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:42:10

696 Views

An array can be converted into a fixed size list using the java.util.Arrays.asList() method. This method is basically a bridge between array based AP!’s and collection based API’s.A program that demonstrates the conversion of an array into a generic list is given as follows −Example Live Demoimport java.util.Arrays; import java.util.Collections; import ... Read More

Multiplicative order in java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:39:40

147 Views

Following is a Java program which prints the multiplicative order of given numbers.import java.util.Scanner;Programpublic class MultiplicativeOrder {    public static int gcd(int num1, int num2) {       if (num2 != 0) {          return gcd(num2, num1 % num2);       } else {   ... Read More

Search elements in a sorted object array in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:38:00

206 Views

An element can be searched in a sorted object array in Java by using the methodjava.util.Arrays.binarySearch(). This method returns the index of the required element if it is available in the array, otherwise it returns (-(insertion point) - 1) where the insertion point is the position at which the element ... Read More

Catalan numbers in java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:25:10

727 Views

The nth Catalan number in terms of binomial coefficients is calculated by the formula(n + k )/k where k varies from 2 to n and n ≥ 0. i.e.Cn = (2n)!/((n+1)!n!)Programpublic class CatalanNumbers {    public static long fact(int i) {       if(i

Java Program to sort an array in case-sensitive order

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:19:25

400 Views

An array can be sorted in case-sensitive order using the java.util.Arrays.sort() method. Only a single argument required in this case for this method i.e. the array to be sorted. A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String ... Read More

Filling byte array in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:13:46

4K+ Views

The byte array in Java can be filled by using the method java.util.Arrays.fill(). This method assigns the required byte value to the byte array in Java. The two parameters required for java.util.Arrays.fill() are the array name and the value that is to be stored in the array elements.A program that ... Read More

Check if a large number is divisible by 3 or not in java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:05:58

5K+ Views

If the sum of the digits of a number is divisible by 3, then the number is divisible by 3.Some examples of numbers divisible by 3 are as follows.The number 85203 is divisible by 3 because the sum of its digits (8 + 5 + 2 + 0 + 3 ... Read More

To check divisibility of any large number by 9 in java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 12:01:29

1K+ Views

If the sum of the digits of a number is divisible by 9, then the number is divisible by 9.Some examples of numbers divisible by 9 are as follows. The number 51984 is divisible by 9 because the sum of its digits (5+ 1 + 9 + 8 + 4 = ... Read More

Align flex items at the beginning of the container with CSS

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 11:49:09

169 Views

Use the justify-content property with value flex-start to align the flex-items at the beginning.You can try to run the following code to implement the flex-start valueExampleLive Demo                    .mycontainer {             display: flex;     ... Read More

Shadow Filter with CSS

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 11:44:27

486 Views

Shadow filter is used to create an attenuated shadow in the direction and color specified.The following parameters can be used in this filterParameterDescriptionColorThe color that you want the shadow to be.DirectionThe direction of the blur, going clockwise, rounded to 45-degree increments. The default value is 270 (left).0 = Top45 = ... Read More

Advertisements