Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Chandu yadav
810 articles
Represent Int64 as a Hexadecimal String in C#
To represent Int64 as a Binary string in C#, use the ToString() method and set the base as the ToString() method’s second parameter i.e.16 for Hexadecimal.Int64 represents a 64-bit signed integer.Firstly, set an Int64 variable.long val = 947645;Now, convert it to a hex string by including 16 as the second parameter.Convert.ToString(val, 16)Exampleusing System; class Demo { static void Main() { long val = 947645; Console.WriteLine("Long: "+val); Console.Write("Hex String: "+Convert.ToString(val, 16)); } }OutputLong: 947645 Hex String: e75bd
Read MoreJava Program to Check if a String is Numeric
ExampleYou can check if a given string is Numeric as shown in the following program.import java.util.Scanner; public class StringNumeric { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter a string ::"); String str = sc.next(); boolean number = str.matches("-?\d+(\.\d+)?"); if(number) { System.out.println("Given string is a number"); } else { System.out.println("Given string is not a number"); } } }OutputEnter a string :: 4245 Given string is a number
Read MoreWhich element is used to add special style to the first letter of the text in a selector with CSS
Use the :first-letter element to add special effects to the first letter of elements in the document. You can try to run the following code to add special styles to the first letter of text −Example p:first-letter { font-size: 5em; } p.normal:first-letter { font-size: 10px; } First character of this paragraph will be normal ...
Read MoreGive the object a sine wave distortion to make it look wave with CSS
Wave effect is used to give the object a sine wave distortion to make it look wavy.The following parameters can be used in this filterS.NoParameter & Description1AddA value of 1 adds the original image to the waved image, 0 does not.2FreqThe number of waves.3LightThe strength of the light on the wave (from 0 to 100).4PhaseAt what degree the sine wave should start (from 0 to 100).5StrengthThe intensity of the wave effect.ExampleYou can try to run the following code to set wave effect − Text Example: CSS Tutorials
Read MoreSet Bordered Form Inputs with CSS
To set border to form inputs, use the CSS border property.You can try to run the following code to add borderExample input[type = text] { width: 100%; padding: 10px 15px; margin: 5px 0; box-sizing: border-box; border: 3px inset orange; } Fill the below form, Subject Student
Read MoreJava program to calculate mode in Java
In statistics math, a mode is a value that occurs the highest numbers of time. For Example, assume a set of values 3, 5, 2, 7, 3. The mode of this value set is 3 as it appears more than any other number.Algorithm1.Take an integer set A of n values. 2.Count the occurrence of each integer value in A. 3.Display the value with the highest occurrence.Examplepublic class Mode { static int mode(int a[], int n) { int maxValue = 0, maxCount = 0, i, j; for (i = 0; i < n; ...
Read MoreIntStream peek() method in Java
The peek() method in the IntStream class in Java returns a stream consisting of the elements of this stream. It additionally performs the provided action on each element as elements are consumed from the resulting stream.The syntax is as followsIntStream peek(IntConsumer action)Here, the parameter action is a non-interfering action to perform on the elements as they are consumed from the stream. The IntConsumer represents an operation that accepts a single int-valued argument and returns no result.The following is an example to implement IntStream peek() method in JavaExampleimport java.util.*; import java.util.stream.IntStream; public class Demo { public static void ...
Read MoreIntStream forEachOrdered() method in Java
The forEachOrdered() method in Java assures that each element is processed in order for streams that have a defined encounter order.The syntax is as followsvoid forEachOrdered(IntConsumer action)Here, the action parameter is a non-interfering action to be performed on the elements.Create an IntStream and add elements to the streamIntStream intStream = IntStream.of(50, 70, 80, 100, 130, 150, 200);Now, use the forEachOrdered() method to display the stream elements in orderintStream.forEachOrdered(System.out::println);The following is an example to implement IntStream forEachOrdered() method in JavaExampleimport java.util.*; import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { ...
Read MoreThe toArray(T[] a) method of CopyOnWriteArrayList in Java
The difference between toArray() and toArray(T[] arr) of the CopyOnWriteArrayList class is that both the methods returns an array containing all of the elements in this collection, but the latter has some additional features i.e. the runtime type of the returned array is that of the specified array.The syntax is as followspublic T[] toArray(T[] arr)Here, the parameter arr is the array into which the elements of the list are to be stored.To work with CopyOnWriteArrayList class, you need to import the following packageimport java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class toArray() method in JavaExampleimport java.util.Arrays; import java.util.concurrent.CopyOnWriteArrayList; ...
Read MoreArrayBlockingQueue drainTo() Method in Java
The drainTo() method of the ArrayBlockingQueue class removes all available elements from this queue and adds them to the given collection. It returns the number of elements transferred.The syntax is as followsint drainTo(Collection
Read More