value whose value is closest to the parameter and is an integerRound (float)Returns an int with the closest parameterRound (double)Returns the nearest parameter of a longSin (double)Returns the triangular sine of a cornersqrt (double)Returns the positive square root of a double value that is rounded correctlyTan (Double)Returns the trigonometric tangent of a cornerTodegrees (Double)Converts the angle measured in radians to an approximate equal angle measured in degreesToradians (Double)Converts
; * } $ Panax Notoginseng Public voidSetchinese (intChinese) { - This. Chinese =Chinese; the } + A Public intGetmath () { the returnMath; + } - $ Public voidSetmath (intmath) { $ This. Math =Math; - } - the Public intGetenglish () { - return中文版;Wuyi } the - Public voidSetenglish (int中文版) { Wu This. 中文版 =中文版; - }
Floor returns the largest integer not greater thanRound is the calculation of 4 5 in, when it is greater than its integerRound method, which means "rounding", the algorithm is Math.floor (x+0.5), the original number is added 0.5 and then rounded down, so the result of Math.Round (11.5) is 12,math.round (-11.5) The result is-11.Ceil is not less than his smallest integerSee Example
Math.floor
Math.Round
Math.ceil
1.4
1
1
2
8243
[Java]View PlainCopy
Public class Mathdemo {
public static void Main (String args[]) {
/**
* ABS Seek absolute value
*/
System.out.println (Math.Abs (-10.4)); //10.4
System.out.println (Math.Abs (10.1)); //10.1
/**
* Ceil ceiling means to return a large value, note some special values
*/
System.out.println (Math.ceil (-10.1)); //-10.0
System.out.println (Math.ceil
4.2 Common mathematical functionsThe methods in the math class are divided into three categories: trigonometric functions, exponential function Methods , and service methods . Service methods include rounding, minimum, maximum, Absolute and random methods. In addition to these methods, the math class provides two usefu
the smallest, so it's good to start with the sqrt (b/=a) to the 1 enumeration.Note: If you have a time-out in C + +. Finally, after the guidance of seniors to use Java ... and learned a trick.Code:Import Java.util.scanner;import java.math.*;p ublic class main{public static void Main (string[] args) {Scanner cin = new SCA Nner (system.in); Long A, B, X, Y;while (
The compatibility types are as follows:Static double abs (double)Returns the absolute value of the double value.Static float abs (float)Returns the absolute value of a float value.Static int abs (int)Returns the absolute value of the int value.Static long abs (long)Returns the absolute value of the long value. The code is as follows:Copy code Package com. java. lang;Public class
patternYYYY-MM-DD HH:mm:ssB: Conversion of dates and stringsA:date--StringFormat ()B:string--DateParse ()C: Case:A tool class for date manipulation was created.8:calendar (Master)(1) The Calendar class, which encapsulates all the Calendar field values, can be obtained using a uniform method based on the incoming different calendar fields.(2) How do I get a calendar object?Calendar RightNow = Calendar.getin
Data types and various math class methods1 Public classHelloWorld {2 Public Static voidMain (String args[]) {3 //familiar with various data types, forcing type conversions to look at levels4 Final intvar = 100;5 intVarr = 200;6 floatm = -21.5f;7 Doublep = 21.234;8 BooleanJudge =true;9 Charch = ' A ';Ten Longnum = 625; One ShortNU
1, the math library static (Static) method random ()
The effect of this method is to produce a double value between 0 and 1 (including 0, but not 1).
The code is as follows
Copy Code
Double rand = Math.random ();
2, through the Random class object
A program can generate many different types of random numbers, simply by invoking Method Nextint () and Nextfloat () (or
Math class:Java.lang.MathThe class contains basic numeric operations such as exponential, logarithmic, square root, and trigonometric functions.Java.math is a package that provides classes for executing arbitrary precision Integer (BigInteger) algorithms and arbitrary Precision Decimal (BigDecimal) algorithms.Java.lang.MathThe class contains two static constants
To kneel and beg for a simple way ......... .....Rules.1. This Council once 10 points plus 2 pitches in the back2 This council complements 10 points plus 1 pitches in the back3 this council 2 times less than 10 points that's all.10th round in any case must first cast 2 times 2 times more than 10 points to increase the investment 1 timesOut of 300Package com.lovo;/** * Bowling Credit Program * @author Abe */import Java.util.scanner;public
Java Draw mathematical function diagram is not very convenient, need to use a third party package jfree, installation or download methods online.
To use the xyseries inside the Jfree, generate a series of data.
Then, based on the generated data, use chart strokes to paint.
Example: 1. Paint y= x^2
import javax.swing.JFrame;
Import Org.jfree.chart.ChartFactory;
: Member MethodGetTime ()SetTime (long time)C: Conversion of date and millisecond values to each otherCase: How many days have you been in this world?(2) DateFormat classes that are formatted for dates and parsed for strings, but are abstract classes, use their subclasses SimpleDateFormatA:simpledateformat (String pattern) given patternYYYY-MM-DD HH:mm:ssB: Conversion of dates and stringsA:date--StringFormat ()B:string--DateParse ()C: Case:A tool class
time and the January 01, 1970 00:00 Point long time=system.currenttimemillis (); // can be used to test how long the program is running System.out.println (time); // ? Used to end a running Java program. parameter to pass in a number. Usually incoming 0 is recorded as the normal state, others are abnormal state system.exit (0); System.out.println ("ending");} Public Static voidMain (string[] args) {//array Copy method in the Syst
Use java to import and export Excel data, and use java Excel to import and export data.
Jxl is used. jar files can be downloaded from the official website. The exported data adopts fake data. The example is very simple.
Model class:
public
("--------------");public static int round (float a) rounded ( self-study with double argument )System.out.println ("Round:" + math.round (12.34f));System.out.println ("Round:" + math.round (12.56f));System.out.println ("--------------");public static double sqrt (double A): positive square rootSystem.out.println ("sqrt:" +math.sqrt (4));}}
Please design a method that can achieve random numbers in any range.
DemoRequirements: Please design a method that can achie
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.