- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34492 Articles for Programming
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
461 Views
To get the floor value of a number, we use the java.lang.Math.floor() method. The Math.floor() method returns the largest (closest to positive infinity) double value which is less than or equal to the parameter and has a value which is equal to a mathematical integer on the number line. If the parameter is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.Declaration - The java.lang.Math.floor() method is declared as follows −public static double floor(double a)Let us see a program to get the floor value of a number in Java.Example Live Demoimport ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
In order to check if a String has only unicode letters in Java, we use the isDigit() and charAt() methods with decision making statements.The isLetter(int codePoint) method determines whether the specific character (Unicode codePoint) is a letter. It returns a boolean value, either true or false.Declaration − The java.lang.Character.isLetter() method is declared as follows −public static boolean isLetter(int codePoint)where the parameter codePoint represents the character to be checked.The charAt() method returns a character value at a given index. It belongs to the String class in Java. The index must be between 0 to length()-1.Declaration − The java.lang.String.charAt() method is declared ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
3K+ Views
To get the exponential value of a number in Java, we use the java.lang.Math.exp() method. The Math.exp() returns a double value which is the Euler’s number e raised to the power of the argument. If the parameter is NaN, the result obtained is NaN. If the argument is positive infinity, then the result is positive infinity. In case the argument is negative infinity, then the output is positive zero.Declaration − The java.lang.Math.exp() method is declared as follows:public static double exp(double a)where a is the number representing the power to which e is raised to.Let us see a program to get ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
1K+ Views
In order to get the ceiling value of a number in Java, we use the java.lang.Math.ceil() method. The Math.ceil() method returns the smallest (closest to negative infinity) double value which is greater than or equal to the parameter and has a value which is equal to a mathematical integer on the number line. If the parameter is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument. If the argument value is less than zero but greater than -1.0, then the value returned is negative zero.Declaration − The java.lang.Math.ceil() method is ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
820 Views
The java.lang.Math class has an abs() method which facilitates us to find the absolute values of different data types.Absolute value of floatIn order to compute the absolute value of a float value, we use the java.lang.Math.abs(float a) method. If the argument ‘a’ is negative, the negation of ‘a’ is returned. If the argument ‘a’ is non-negative, the argument itself is returned. When the argument is positive zero or negative zero, the result is positive zero. In case the argument is infinite, the result is positive infinity. If the argument is NaN, the result is NaN.Declaration − The declaration of Math.abs(float ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
301 Views
In order to place stack trace into a String in Java, we use the java.io.StringWriter and java.io.PrintWriter classes. In a catch block, after catching the exception, we print the stack trace by printStackTrace() method and write it into the writer and then use the ToString() method to convert it into a String.Let us see a program to place the stack trace into a String in Java.Example Live Demoimport java.io.PrintWriter; import java.io.StringWriter; public class Example { public static void main(String[] args) { try{ int ans = 10/0; }catch (ArithmeticException ex) { ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
5K+ Views
In order to print the stack trace in Java, we use the java.lang.Throwable.printStackTrace() method. The printStackTrace() method prints the throwable and its backtrace in the standard error stream.Declaration - The java.lang.Throwable.printStackTrace() method is declared as follows −public void printStackTrace()Let us see a program to print the stack trace in Java.Example Live Demopublic class Example { public static void main(String args[]) throws Throwable { try { int n = 3; System.out.println(n/0); } catch (ArithmeticException e) { System.out.println("Printing stack trace..."); ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
372 Views
In order to check if a String has only unicode digits in Java, we use the isDigit() method and charAt() method with decision making statements.The isDigit(int codePoint) method determines whether the specific character (Unicode codePoint) is a digit. It returns a boolean value, either true or false.Declaration − The java.lang.Character.isDigit() method is declared as follows −public static boolean isDigit(int codePoint)where the parameter codePoint represents the character to be checked.The charAt() method returns a character value at a given index. It belongs to the String class in Java. The index must be between 0 to length()-1.Declaration − The java.lang.String.charAt() method is ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
4K+ Views
In order to check if a String has only unicode digits or space in Java, we use the isDigit() method and the charAt() method with decision making statements.The isDigit(int codePoint) method determines whether the specific character (Unicode codePoint) is a digit. It returns a boolean value, either true or false.Declaration - The java.lang.Character.isDigit() method is declared as follows −public static boolean isDigit(int codePoint)The charAt() method returns a character value at a given index. It belongs to the String class in Java. The index must be between 0 to length()-1.Declaration − The java.lang.String.charAt() method is declared as follows −public char charAt(int ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
22K+ Views
Before converting a String to UTF-8-bytes, let us have a look at UTF-8.UTF-8 is a variable width character encoding. UTF-8 has ability to be as condense as ASCII but can also contain any unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies that it allocates 8-bit blocks to denote a character. The number of blocks needed to represent a character varies from 1 to 4.In order to convert a String into UTF-8, we use the getBytes() method in Java. The getBytes() method encodes a String into a sequence of ... Read More