Number.parseInt Function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:48:02

83 Views

The parseInt() function of the Number object accepts a string, parses and returns an integer of the specified radix or base.SyntaxIts Syntax is as followsNumber.parseInt('0xF', 16);Example Live Demo    JavaScript Example           var result = Number.parseInt('0xF', 16);       document.write(result);     Output15

Divisors of Factorials of a Number in Java

Chandu yadav
Updated on 25-Jun-2020 12:47:39

235 Views

Following is a Java program to find the divisors of factorials of a number.Programimport java.util.Scanner; public class DivisorsOfFactorial {    public static long fact(int i) {       if(i

Legendre's Formula in Java

George John
Updated on 25-Jun-2020 12:46:49

294 Views

You can calculate the exponent of the largest power of a PrimeNumber that divides the factorial n! using Legendre's formula.Programimport java.util.Scanner; public class LegendresFormula {    static int Largestpower(int n, int p) {       int ans = 0;       while (n > 0) {          n /= p;          ans += n;       }       return ans;    }    public static void main (String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter the n value :");     ... Read More

Use Reflection to Create, Fill and Display an Array in Java

Chandu yadav
Updated on 25-Jun-2020 12:44:15

269 Views

An array is created using the java.lang.reflect.Array.newInstance() method. This method basically creates a new array with the required component type as well as length.The array is filled using the java.lang.reflect.Array.setInt() method. This method sets the required integer value at the index specified for the array.The array displayed using the for loop. A program that demonstrates this is given as follows −Example Live Demoimport java.lang.reflect.Array; public class Demo {    public static void main (String args[]) {       int arr[] = (int[])Array.newInstance(int.class, 10);       int size = Array.getLength(arr);       for (int i = 0; iRead More

Math Tanh Function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:44:07

77 Views

The tanh() function of the Math object accepts an angle (in radians) and returns its hyperbolic tangent value.SyntaxIts Syntax is as followsMath.tanh(90)Example Live Demo    JavaScript Example           var result = Math.tanh(90);       document.write("Hyperbolic tangent value of the given angle: "+result);     OutputHyperbolic tangent value of the given angle: 1

Number Epsilon Property in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:43:46

179 Views

The Number.EPSILON property of the Number object represents the difference between 1 and the smallest floating point number greater than 1.SyntaxIts Syntax is as followsNumber.EPSILONExample Live Demo    JavaScript Example           var result = Number.EPSILON;       document.write("Value of the epsilon : " + result);     OutputValue of the epsilon: 2.220446049250313e-16

Number.MAX_SAFE_INTEGER Property in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:43:22

154 Views

The Number.MAX_SAFE_INTEGER property of the Number object represents the maximum safe integer in JavaScript (i.e. 253 - 1).SyntaxIts Syntax is as followsNumber.MAX_SAFE_INTEGERExample Live Demo    JavaScript Example           var result = Number.MAX_SAFE_INTEGER;       document.write("Maximum safe integer: " + result);     OutputMaximum safe integer: 9007199254740991

Number.MIN_SAFE_INTEGER Property in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:42:30

115 Views

The Number.MIN_SAFE_INTEGER property of the Number object represents the minimum safe integer in JavaScript (i.e. –(253 – 1)).SyntaxIts Syntax is as followsNumber.MIN_SAFE_INTEGERExample Live Demo    JavaScript Example           var result = Number.MIN_SAFE_INTEGER;       document.write("Minimum safe integer: " + result);     OutputMinimum safe integer: -9007199254740991

Convert Array to Generic List with Java Reflections

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

714 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 java.util.List; public class Demo {    public static void main(String[] args) {       String str[] = new String[]{"apple", "orange", "mango", "guava", "melon"};       List list = Arrays.asList(str);       System.out.println("The list is: " + list);    } }The output of the above program is as ... Read More

Compare Two Long Arrays in a Single Line in Java

Ankith Reddy
Updated on 25-Jun-2020 12:41:40

219 Views

Two long arrays can be compared in Java using the java.util.Arrays.equals() method. This method returns true if the arrays are equal and false otherwise. The two arrays are equal if they contain the same number of elements in the same order.A program that compares two long arrays using the Arrays.equals() method is given as follows −Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] argv) throws Exception {       boolean flag = Arrays.equals(new long[] { 450L, 150L, 375L }, new long[] { 450L, 150L, 375L });       System.out.println("The two long arrays are equal? ... Read More

Advertisements