java速查表

001.Math类

java.util.Math类是数学相关的工具类,里面提供了大量的静态方法,完成与数学运算相关的操作。

import java.lang.Math;
double abs(); // 取绝对值
double ceil(); //向上取整
double floor(); //向下取整
long round(double num); //四舍五入
002.数组工具类Arrays

java.utils.Arrays是一个与数组相关的工具类,里面提供了大量静态方法,用来实现数组常见的操作。

import java.util.Arrays;
static String toString(数组); //将参数数组变成字符串(按照默认格式:[1, 2, 3])
static void sort(数组); // 按照默认升序对数组的元素进行排序
003. ArrayList
import java.util.ArrayList;
ArrayList<String> list = new ArrayList<>();
public boolean add(E e); //将指定的元素添加到此集合的尾部。
public E remove(int index); //移除此集合中指定位置上的元素。返回被删除的元素。
public E get(int index); //返回此集合中指定位置上的元素。返回获取的元素。
public int size(); //返回此集合中的元素数。
004.Calendar
import java.tuil.Calendar;
/*
public int get(int field): //返回给定日历字段的值
参数:传递指定的日历字段(YEAR, MONTH)
返回值:日历字段代表的具体的值
int Year = 1;年
int MONTH = 2;月 
int DATA = 5; 月中的某一天
int DAY_OF_MONTH = 5; 月中的某一天
int HOUR = 10; 时
int MINUTE = 12; 分
int SECOND = 13; 秒
注意:西方的月份0-11, 东方的月份1-12。
*/
Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR)
int month = c.get(Calendar.MONTH)
    
/*
public int set(int field, int value): //将给定的日历字段设置为给定值
int Year = 1;年
int MONTH = 2;月 
int DATA = 5; 月中的某一天
*/
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, 2099)
005.Scanner类

一个可以解析基本类型和字符串的简单文本扫描器。

import java.util.Scanner;
Scanner sc = new Scanner(System.in);
int i = sc.nextInt(); // 接收一个键盘录入的整数
006.Random类
import java.util.Random;
Random r = new Random(); // 创建一个随机数生成器
public int nextInt(int n); //返回一个伪随机数,范围在0和n (不包括)之间的 int 值。
007.String类

构造方法:

// 无参构造 
String str = new String(); 
// 通过字符数组构造 
char chars[] = {'a', 'b', 'c'}; 
String str2 = new String(chars); 
// 通过字节数组构造 
byte bytes[] = { 97, 98, 99 }; 
String str3 = new String(bytes);

常用方法:

public boolean equals (Object anObject); //将此字符串与指定对象进行比较。
public boolean equalsIgnoreCase (String anotherString); //将此字符串与指定对象进行比较,忽略大小 写。
public int length ();//返回此字符串的长度。 
public String concat (String str);//将指定的字符串连接到该字符串的末尾。 
public char charAt (int index); //返回指定索引处的 char值。 
public int indexOf (String str); //返回指定子字符串第一次出现在该字符串内的索引。 
public String substring (int beginIndex) :返回一个子字符串,从beginIndex开始截取字符串到字符 串结尾。 
public String substring (int beginIndex, int endIndex); //返回一个子字符串,从beginIndex到 endIndex截取字符串。含beginIndex,不含endIndex。

转换方法:

public char[] toCharArray (); //将此字符串转换为新的字符数组。 
public byte[] getBytes (); //使用平台的默认字符集将该 String编码转换为新的字节数组。 
public String replace (CharSequence target, CharSequence replacement); //将与target匹配的字符串使 用replacement字符串替换。

分割:

public String[] split(String regex); //将此字符串按照给定的regex(规则)拆分为字符串数组
008.System类

java.lang.System类中提供了大量的静态方法,可以获取与系统相关的信息或系统级操作,在System类的API文档中,常用的方法有:

  • public static long currentTimeMillis():返回以毫秒为单位的当前时间。
  • public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length):将数组中指定的数据拷贝到另一个数组中。
009.StringBuilder类

StringBuilder又称为可变字符序列,是一个字符串的缓冲区,即它是一个容器,容器中可以装很多字符串。并且能够对其中的字符串进行各种操作。

构造方法:

public StringBuilder(); //构造一个空的StringBuilder容器。
public StringBuilder(String str); //构造一个StringBuilder容器,并将字符串添加进去。

常用方法:

public StringBuilder append(); //添加任意类型数据的字符串形式,并返回当前对象自身。
public String toString(); //将当前StringBuilder对象转换为String对象。
Java函数速查,方便使用的Java类库查询手册 chm版,可查询以下四个包的所有类库内容:   Package com.ms.wfc.app   Application类   CharacterSet类   Clipboard类   DataFormats类   DataFormats.Formats类   DataObject类   IDataObject界面   IMessageFilter界面   Locale类   Locale.CalendarType类   Locale.DateFormatOrder类   Locale.Languages类   Locale.LeadingZeros类   Locale.MeasurementSystem类   Locale.NegativeNumberMode类   Locale.OptionalCalendarType类 Locale.PositiveCurrencyMode类   Locale.Sort类   Locale.SubLanguages类   Message类   MethodInvoker代理   Registry类   RegistryKey类   SendKeys类   SpecialFolder类   SystemInformation类   SystemInformation.ArrangeDirection类   SystemInformation.ArrangeStartingPosition类   ThreadExceptionDialog类   ThreadExceptionEvent类   ThreadExceptionEventHandler代理   Time类   Timer类   Version类   Window类   Package com.ms.wfc.data.ui   Column类   ColumnEditingEvent类   ColumnEditingEventHandler代理   ColumnEvent类   ColumnEventHandler代理   ColumnResizeEvent类   ColumnResizeEventHandler代理   ColumnUpdatingEvent类   ColumnUpdatingEventHandler代理   DataBinder类   DataBinding类   DataGrid类   DataNavigator类   DataSource类   EnterAction类   ErrorEvent类   ErrorEventHandler代理   GridLineStyle类   PositionChangeEvent类   PositionChangeEventHandler代理   Scrollbars类   TabAction类      Package com.ms.wfc.html   DhAlignment类   DhBaseContainer类   DhBorderInfo类   DhBorders类   DhBorderStyle类   DhBreak类   DhBrowser类   DhBulletedList类   DhButton类   DhCantAddElementException类   DhCantModifyElementException类   DhCell类   DhCheckBox类   DhComboBox类   DhComponentWrapper类   DhCursor类   DhDialogInfo类   DhDocument类   DhEdit类   DhElement类   DhElementExistsInDocumentException类   DhElementNotFoundException类   DhEnumeration类   DhEventInfo类   DhForm类   DhHorizontalRule类   DhHotSpot类   DhHotSpotShapes类   DhHTMLGenerator类   DhHyperlink类   DhImage类   DhInlineFrame类   DhInsertOptions类   DhJumpPoint类   DhLinkTarget类   DhListBox类   DhListType类   DhMargins类   DhMarginWidthI
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值