Karthikeya Boyini has Published 2193 Articles

Convert Char array to String in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 06:24:54

829 Views

The valueOf() method is used in Java to convert char array to string.Here is our char array.// char array char[] c = {'p', 'q', 'r', 's', 't', 'u', 'v'};To convert it to string, use the valueOf() method.String str = String.valueOf(c);Example Live Demopublic class Demo {    public static void main(String[] args) ... Read More

Time Functions in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 06:19:02

820 Views

Java provides the Date class available in java.util package, this class encapsulates the current date and time. The time functions can be accessed from the java.util.Date class. This represents an instance of time with millisecond precision.One of the time function in Java is the getTime() function. It returns the number ... Read More

Java program to display Astrological sign or Zodiac sign for given date of birth

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 05:42:05

7K+ Views

Each date of birth corresponds to a given Zodiac sign. A table that demonstrates these signs and their corresponding dates is given below −Zodiac SignDateAriesMarch 21 - April 19TaurusApril 20 - May 20GeminiMay 21 - June 20CancerJune 21 - July 22LeoJuly 23 - August 22VirgoAugust 23 - September 22LibraSeptember 23 ... Read More

Reverse words in a given String in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 14:16:25

5K+ Views

The order of the words in a string can be reversed and the string displayed with the words in reverse order. An example of this is given as follows.String = I love mangoes Reversed string = mangoes love IA program that demonstrates this is given as follows.Example Live Demoimport java.util.regex.Pattern; public ... Read More

Sort the words in lexicographical order in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 14:03:52

2K+ Views

The words are sorted in lexicographical order or dictionary order. This means that the words are alphabetically ordered based on their component alphabets. An example of this is given as follows.The original order of the words is Tom Anne Sally John The lexicographical order of the words is Anne John ... Read More

Java program to print all distinct elements of a given integer array in Java

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 13:51:31

6K+ Views

All distinct elements of an array are printed i.e. all the elements in the array are printed only once and duplicate elements are not printed. An example of this is given as follows.Array = 1 5 9 1 4 9 6 5 9 7 Distinct elements of above array = ... Read More

Java Program to check whether the character is ASCII 7 bit numeric

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 13:38:30

217 Views

To check whether the entered value is ASCII 7-bit numeric, check the character from ‘0’ to ‘9’.Here, we have a numeric character.char one = '9';Now, we have checked a condition with if-else for numeric character from ‘0’ to ‘9’if (c >= '0' && c = '0' && c = '0' ... Read More

TypedArray.set() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 13:36:31

45 Views

The set() function of TypedArray object accepts an array a number representing the index and copies the contents of the specified array in to the current array starting at the given index.SyntaxIts Syntax is as followstypedArray.set()Example Live Demo    JavaScript Array every Method           ... Read More

TypedArray.sort() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 13:33:45

120 Views

The sort() method of the Typed Array object arranges the elements of the array in ascending order and returns it.SyntaxIts Syntax is as followsarrayBuffer.sort()Example Live Demo    JavaScript Array every Method           var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, ... Read More

TypedArray.subarray() function in JavaScript

karthikeya Boyini

karthikeya Boyini

Updated on 25-Jun-2020 13:32:43

78 Views

The subarray() function of the TypedArray object returns portion of the current array. It accepts two numbers representing the start and end of the sub array.SyntaxIts Syntax is as followstypedArray.subarray(5, 9)Example Live Demo    JavaScript Example           var typedArray = new Int32Array([111, 56, 62, ... Read More

Advertisements