Samual Sam has Published 2492 Articles

ezmlm_hash() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

66 Views

The ezmlm_hash() function calculates the hash value needed when keeping EZMLM mailing lists in a MySQL database.Syntaxezmlm_hash(addr);Parametersaddr − The email address being hashed.ReturnThe ezmlm_hash() function returns the hash value of addr.ExampleThe following is an example −

Java Program to divide one BigDecimal from another BigDecimal

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

111 Views

Use the divide method to divide one BigDecimal to another in Java. The method returns a BigDecimal whose value is (this / divisor), and whose preferred scale is (this.scale() - divisor.scale()).If the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an ArithmeticException is thrown.The following is ... Read More

Display hour in KK (00-11) format in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

147 Views

The “KK” format in Java Date is used to display hour in 00-11.. Use SimpleDateFormat("KK") to get the same format −// displaying hour in KK format SimpleDateFormat simpleformat = new SimpleDateFormat("KK"); String strHour = simpleformat.format(new Date()); System.out.println("Hour in KK format = "+strHour);Above, we have used the SimpleDateFormat class, therefore the ... Read More

Set Decimal Place of a Big Decimal Value in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

4K+ Views

We have the following BigDecimal value −BigDecimal val1 = new BigDecimal("37578975587.876876989");We have set the decimal place to be −int decPlaces1 = 3;Now, we will use the ROUND_DOWN field to set the rounding mode to round towards zero −// ROUND_DOWN val1 = val1.setScale(decPlaces1, BigDecimal.ROUND_DOWN); String str1 = val1.toString(); System.out.println("Result = "+str1);To ... Read More

connection_status() function in PHP

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

109 Views

The connection_status() function returns the connection status.Syntaxconnection_status()ParametersNAReturnThe connection_status() function returns the following possible values. This is the status bitfield −0 - CONNECTION_NORMAL - connection is running normally1 - CONNECTION_ABORTED - connection is aborted by user or network error2 - CONNECTION_TIMEOUT - connection timed out3 - CONNECTION_ABORTED & CONNECTION_TIMEOUTExampleThe following is ... Read More

Math operations for BigDecimal in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

4K+ Views

Let us apply the following operations on BigDecimal using the in-built methods in Java −Addition: add() method Subtraction: subtract() method Multiplication: multiply() method Division: divide() methodLet us create three BigInteger objects −BigDecimal val1 = new BigDecimal("37578975587.876876989"); BigDecimal val2 = new BigDecimal("62567875598.976876569"); BigDecimal val3 = new BigDecimal("72567875598.376876569");Apply mathematical operations on them ... Read More

Java Program to get the maximum of three long values

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

146 Views

Firstly, let us declare and initialize three long values −long val1 = 98799; long val2 = 98567; long val3 = 98768;Now, find the maximum of three long values using the following condition −// checking for maximum if (val2 > val1) { val1 = val2; } if (val3 ... Read More

Java Program to create Big Decimal Values via a string

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

65 Views

Let’s create BigDecimal value with a stringBigDecimal val1 = new BigDecimal("37578975.8768"); BigDecimal val2 = new BigDecimal("62567878.9768");You can also set the above as −String str1 = “37578975.8768”; BigDecimal val1 = new BigDecimal(str1); String str2 = “62567878.9768”; BigDecimal val2 = new BigDecimal(str2);Now, you can also perform operations like −val1 = val1.add(val2); System.out.println("Addition ... Read More

Convert String to Long in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

310 Views

To convert String to Long, use the valueOf() method.Let’s say the following is our string.// string String myStr = "5"; System.out.println("String: "+myStr);To convert it to Long, we have used valueOf() −Long longObj = Long.valueOf(myStr);The following is the complete example to convert a String value to Long −Example Live Demopublic class Demo ... Read More

SimpleDateFormat(“Z”) in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:24

5K+ Views

The Z means "zero hour offset", also known as "Zulu time" (UTC) in the ISO 8601 time representation. However, ACP 121 standard defines the list of military time zones and derives the "Zulu time" from the Greenwich Mean Time (GMT).TimeZone can be formatted in z, Z or zzzz formats.The following ... Read More

Advertisements