Karthikeya Boyini has Published 2193 Articles

Retrieve environment variables with Java Map Collection

karthikeya Boyini

karthikeya Boyini

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

475 Views

First, use the getenv() method to get the environment variables −System.out.println("PATH = " + System.getenv("PATH"));Now, get the key and value. Loop through to get the list of environment variables −Map e = System.getenv(); for (Iterator i = e.entrySet().iterator(); i.hasNext();) { Map.Entry mapEntry = (Map.Entry) i.next(); ... Read More

Math Operations on BigInteger in Java

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Let us apply the following operations on BigInteger using the in-built methods in Java.Addition: add() method Subtraction: subtract() method Multiplication: multiply() method Division: divide() methodLet us create three BigInteger objects.BigInteger one = new BigInteger("98765432123456789"); BigInteger two = new BigInteger("94353687526754387"); BigInteger three = new BigInteger("96489687526737667");Apply mathematical operations on them.one = one.add(two); ... Read More

ftp_rename() function in PHP

karthikeya Boyini

karthikeya Boyini

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

331 Views

The ftp_rename() function renames a file or directory on the FTP server.Syntaxftp_rename(conn, oldname, newname);Parametersconn − The FTP connectionold_name − The file or directory to rename.new_name − The new name of the file or directoryReturnThe ftp_rename() function returns TRUE on success or FALSE on failure.ExampleThe following is an example −Read More

BigInteger.isProbablePrime() method in Java

karthikeya Boyini

karthikeya Boyini

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

298 Views

TheBigInteger.isProbablePrime(int certainty) returns true if this BigInteger is probably prime, false if it's definitely composite. If certainty is ≤ 0, true is returned.Here, the “certainty” parameter is a measure of the uncertainty that the caller is willing to tolerate: if the call returns true the probability that this BigInteger is ... Read More

ftp_set_option() function in PHP

karthikeya Boyini

karthikeya Boyini

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

103 Views

The ftp_set_option() function sets runtime options for the FTP connection.Syntaxftp_set_option(conn, option, value);Parametersconn − The FTP connectionoption − The runtime option to set. The following are the possible values:- FTP_TIMEOUT_SEC- FTP_AUTOSEEKvalue − The value of the option parameter set aboveReturnThe ftp_set_option() function returns TRUE if the option could be set, or ... Read More

Create BigDecimal Values via a long in Java

karthikeya Boyini

karthikeya Boyini

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

162 Views

Let us see how we can create BigDecimal values via a long. Here, we have set long values as a parameter to the BigDecimal constructor.BigDecimal val1 = BigDecimal.valueOf(289L); BigDecimal val2 = BigDecimal.valueOf(299L);We can also perform mathematical operations on it −val2 = val2.subtract(val1);The following is an example −Example Live Demoimport java.math.BigDecimal; public ... Read More

Multiply one BigDecimal to another BigDecimal in Java

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Use the multiply() method to multiply one BigDecimal to another in Java. This method returns a BigDecimal whose value is (this × multiplicand), and whose scale is (this.scale() + multiplicand.scale()).The following is an example −Example Live Demoimport java.math.BigDecimal; public class Demo { public static void main(String[] argv) throws ... Read More

ftp_size() function in PHP

karthikeya Boyini

karthikeya Boyini

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

87 Views

The ftp_size() function is used to get the size of a particular file on the FTP server.Syntaxftp_size(conn, myfile)Parametersconn − The FTP connectionmyfile − The server fileReturnThe ftp_size() function returns the size of the particular file in bytes on success.ExampleThe following is an example to get the size of file “new.txt” ... Read More

Display AM/PM time marker with SimpleDateFormat(“a”) in Java

karthikeya Boyini

karthikeya Boyini

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

913 Views

You can display AM/PM time marker easily in Java using SimpleDateFormat(“a”).Firstly, to work with SimpleDateFormat class in Java, import the following package.import java.text.SimpleDateFormat;Now, set the format with SimpleDateFormat(“a”) to display AM/PM marker −Format f = new SimpleDateFormat(”a”);Now, get the marker in a string −String strMarker = f.format(new Date());The following is ... Read More

SimpleDateFormat('zzzz') in Java

karthikeya Boyini

karthikeya Boyini

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

862 Views

TimeZone can be formatted in z, Z or zzzz formats.The following is an example that displays how to implement SimpleDateFormat('zzzz') −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { ... Read More

Advertisements