Karthikeya Boyini has Published 2383 Articles

DataView.byteLength property in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 10:18:46

82 Views

The byteLength property of the DataView represents the length of the current Data View.SyntaxIts syntax is as followsdataView.byteLength();Example Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(8);       var dataView = new DataView(arrayBuffer);       document.write(dataView.byteLength);     Output8

DataView.buffer property in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 10:17:40

107 Views

The buffer property of the DataView represents the ArrayBuffer of the current DataView.SyntaxIts syntax is as followsdataView.buffer;ExampleTry the following example. Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(156);       var dataView = new DataView(arrayBuffer);       document.write(dataView.buffer.byteLength);     Output156

Java program to extract ‘k’ bits from a given position

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 10:04:23

399 Views

Extraction of k bits from the given position in a number involves converting the number into its binary representation. An example of this is given as follows −Number = 20 Binary representation = 10100 k = 3 Position = 2 The bits extracted are 010 which represent 2.A program that ... Read More

Convert an ArrayList to an Array with zero length Array in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:59:33

143 Views

An ArrayList can be converted into an Array using the java.util.ArrayList.toArray() method. This method takes a single parameter i.e. the array of the required type into which the ArrayList elements are stored and it returns an Array that contains all the elements of the ArrayList in the correct order.A program ... Read More

ArrayBuffer.isView() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:57:17

152 Views

ArrayBuffer object in JavaScript represents a fixed-length binary data buffer. The isView() function of this object accepts an argument and verifies whether it is view of ArrayBuffer (DataView, typed array). If so, it returns true else, it returns false.SyntaxIts syntax is as followsarrayBuffer.isView(arg)ExampleTry the following example. Live Demo    JavaScript ... Read More

Atomics.add() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:56:17

99 Views

The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.The add() function of this object accepts a number and the position, adds the given number to the ... Read More

Atomics.or() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:55:16

76 Views

The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.The or() function of the atomic object accepts a value representing the position of an array, performs bitwise ... Read More

Get the union of two sets in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:54:57

5K+ Views

To get the union of two sets, use the addAll() method.The first set −HashSet set1 = new HashSet (); set1.add("Mat"); set1.add("Sat"); set1.add("Cat");The second set −HashSet set2 = new HashSet (); set2.add("Mat"); set2.add("Cat"); set2.add("Fat"); set2.add("Hat");Get the union −set1.addAll(set2);The following is an example −Example Live Demoimport java.util.*; public class Demo { ... Read More

Atomics.load() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:54:19

104 Views

The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.The load() function of the Atomic object returns the value at a given position of an array.SyntaxIts syntax ... Read More

Atomics.sub() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 09:53:06

86 Views

The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.The sub() function of the atomic object accepts a number and the position, subtracts the given number from ... Read More

Advertisements