karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 37 of 143

Convert day of year to day of month in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 670 Views

Firstly, set the day of year using DAY_OF_YEAR constant.Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2018); cal.set(Calendar.DAY_OF_YEAR, 320);Now, get the day of month −int res = cal.get(Calendar.DAY_OF_MONTH);The following is an example −Exampleimport java.util.Calendar; public class Demo {    public static void main(String[] args) {       Calendar cal = Calendar.getInstance();       cal.set(Calendar.YEAR, 2018);       cal.set(Calendar.DAY_OF_YEAR, 320);       System.out.println("Date = " + cal.getTime());       int res = cal.get(Calendar.DAY_OF_MONTH);       System.out.println("Day of month = " + res);    } }OutputDate = Fri Nov 16 07:54:55 UTC 2018 Day of month = 16

Read More

bindec() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 151 Views

The bindec() function convert a binary number to decimal number.Syntaxbindec(bin_str)Parametersbin_str − The binary string to convertReturnThe bindec() function returns decimal value of the specified string bin_strExampleOutputThe output displays that the bindec() function returns a decimal value:13

Read More

Date Class in C#

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 14K+ Views

To set dates in C#, use DateTime class. The DateTime value is between 12:00:00 midnight, January 1, 0001 to 11:59:59 P.M., December 31, 9999 A.D.Let’s create a DateTime object.Exampleusing System; class Test {    static void Main() {       DateTime dt = new DateTime(2018, 7, 24);       Console.WriteLine (dt.ToString());    } }Output7/24/2018 12:00:00 AMLet us now get the current date and time.Exampleusing System; class Test {    static void Main() {       Console.WriteLine (DateTime.Now.ToString());    } }Output9/17/2018 5:49:21 AMNow using the method Add(), we will add days in a date with the DateTime structure.Exampleusing ...

Read More

Java Program to construct one String from another

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 537 Views

To construct on string from another, firstly take a charcter array for the first string.char ch[] = { 'A', 'M', 'I', 'T' }; String str1 = new String(ch);The above forms first string. Now, let us created another string from the first string.String str2 = new String(str1);In this way, we can easily construct one string from another.Examplepublic class Demo {    public static void main(String[] args) {       char ch[] = { 'A', 'M', 'I', 'T' };       String str1 = new String(ch);       String str2 = new String(str1);       String str3 = ...

Read More

decbin() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 142 Views

The decbin() function converts a decimal number to binary number.Syntaxdecbin(num)Parametersnum − Specifies a number to be converted to binary.ReturnThe decbin() function Returns a string representing the binary number of the decimal value.ExampleOutput111100011001ExampleLet us see another example −Output1100011

Read More

exp() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 122 Views

The exp() function Returns ex. This is e raised to the power x.Here,'e' is 2.718282 x is the powerSyntaxexp(x)Parametersx = The exponentReturnThe exp() function Returns e raised to the power of x, which is a float value.ExampleOutput12.718281828459Let us see another example −ExampleOutput7.3890560989307148.41315910258485165195.40979

Read More

C# program to accept two integers and return the remainder

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 729 Views

Firstly, set the two numbers.int one = 250; int two = 200;Now pass those numbers to the following function.public int RemainderFunc(int val1, int val2) {    if (val2 == 0)    throw new Exception("Second number cannot be zero! Cannot divide by zero!");    if (val1 < val2)    throw new Exception("Number cannot be less than the divisor!");    else    return (val1 % val2); }Above we have checked for two conditions i.e.If the second number is zero, an exception occurs.If the first number is less than the second number, an exception occurs.To return remainder of two numbers, the following is ...

Read More

floor() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 204 Views

The ceil() function rounds a number down to the nearest integer.Syntaxfloor(num)Parametersnum − The number to round upReturnThe floor() function Returns the value rounded up to the nearest (down) integer.ExampleOutput0 0Let us see another example −ExampleOutput9Let us see another example −ExampleOutput7 -5

Read More

Create BigInteger via long type variable in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 605 Views

BigInteger class is used for big integer calculations which are outside the limit of the primitive data types. It provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations.Firstly, set a long value −Long l = 198L;Now, create a new object for BigInteger and pass the above value −BigInteger bInteger = new BigInteger(l);The following is an example −Exampleimport java.math.BigInteger; public class Demo {    public static void main(String[] argv) throws Exception {       Long l = 198L;       BigInteger bInteger = BigInteger.valueOf(l);       System.out.println(bInteger);    } }Output198

Read More

What is the Item property of BitArray class in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 137 Views

The Item property of the BitArray class gets or sets the value of the bit at a specific position in the BitArray.Use the keyword to define the indexers instead of implementing the Item property. To access an element, use the mycollection[index].The following is the implementation of BitArray class Item property −Exampleusing System; using System.Collections; class Demo {    static void Main() {       bool[] arr = new bool[5];       arr[0] = true;       arr[1] = true;       arr[2] = false;       arr[3] = false;       BitArray bArr ...

Read More
Showing 361–370 of 1,421 articles
« Prev 1 35 36 37 38 39 143 Next »
Advertisements