Chandu yadav has Published 1091 Articles

Sort Byte Array in Java

Chandu yadav

Chandu yadav

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

337 Views

A byte array can be sorted using the java.util.Arrays.sort() method with a single argument required 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[] args) {       byte[] arr = ... Read More

Smith Numbers in java

Chandu yadav

Chandu yadav

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

1K+ Views

A composite number whose sum of digits equal to the sum of the digits of its prime factors.Ex: 58 = 2 x 29 (5 + 8 = 12) (2+ 2 + 9 = 12)Programpublic class SmithNumbers {    public static boolean isPrime(int number) {       int loop;   ... Read More

Computer elapsed time of an operation in milliseconds in Java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 12:15:48

619 Views

To compute the elapsed time of an operation in milliseconds in Java, we use the System.currentTimeMillis() method. The java.lang.System.currentTimeMillis() returns the current time in milliseconds.Declaration −The java.lang.System.currentTimeMillis() is declared as follows −public static long currentTimeMillis()The method returns time difference in milliseconds between the current time and midnight, January 1, 1970 ... Read More

Java Program to fill elements in a byte array

Chandu yadav

Chandu yadav

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

250 Views

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

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

Chandu yadav

Chandu yadav

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

1K+ Views

A number is divisible by 11 if the difference between the sum of its alternative digits is divisible by 11.i.e. if (sum of odd digits) – ( sum of even digits) is 0 or divisible by 11 then the given number is divisible by 11.Programimport java.util.Scanner; public class DivisibleBy11 ... Read More

GCD and LCM of two numbers in Java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 11:57:26

972 Views

Following is an example which computes find LCM and GCD of two given numbers.Programimport java.util.Scanner; public class LCM_GCD {    public static void lcm(int a, int b){       int max, step, lcm = 0;       if(a > b){          max = step = ... Read More

Perform Animation on border-right-width property

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 11:47:36

103 Views

To implement animation on border-right-width property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 500px;             height: 300px;         ... Read More

Animated background with CSS

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 11:28:48

627 Views

Use the @keyframes to animate. To implement animation on background with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 400px;             height: 300px;             animation: myanim 3s infinite;          }          @keyframes myanim {             30% {                background: green bottom right/50px 50px;             }          }                        

Specify how much a flex item will shrink relative to the rest of the flex items with CSS

Chandu yadav

Chandu yadav

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

108 Views

The flex-shrink property shrinks the flex-item.You can try to run the following code to implement the CSS flex-shrink property. ExampleLive Demo                    .mycontainer {             display: flex;             background-color: orange;     ... Read More

Understanding base64 encode in MySQL?

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 11:24:04

3K+ Views

To encode base64, you can use two functionalities −TO_BASE64()FROM_BASE64()The syntax for base64 encode is as follows −SELECT TO_BASE64(anyValue) as AnyVariableName;The syntax for base64 decode is as follows −SELECT FROM_BASE64(encodeValue) as anyVariableNameTo understand the above concept, let us use the above syntax −Case 1 − EncodeTo encode the value, use the to_base64(). ... Read More

Advertisements