Big Data Big Data learning self-study route route of a good programmer

Big Data Big Data learning self-study route route of a good programmer

System class

Exit () : terminate a virtual machine

gc () : Runs the garbage collection mechanism

with currentTimeMillis () : returns the current time in milliseconds

arraycopy(Object src,int srcPos, Object dest,int destPos,int length)

Copies an array from the specified source array, beginning at the specified location, the end of the array to the target location specified

String

Immutable string: String

String s = "s";

Immutable string is a constant, it will change to the new open space

In heap area storing string constant

A string constant with a value stored in only allows constant region

s1 = "1000"; s2 = "1000"; s1==s2;//true

a = "00"; s3 = "10"+a; s1==s3;//false

s4 = "10"+new String("00"); s1==s4;//false

String default rewrite the Object 's equals () method, you can compare the value of

String common method

The contains 1.boolean (CharSequence S) : comprising determining whether a substring

The equals 2.boolean (Object anObject) : the contents of two strings are the same determination

EqualsIgnoreCase 3.boolean (String anotherString) : Ignore case to determine the contents of the two strings are the same

StartsWith 4.boolean (String prefix) : to determine whether the beginning of a string

EndsWith 5.boolean (String suffix) : determining whether a string ends with

6. converting the character string into an array:

1. Constructors: String (char [] value) , String (char [] value, int offset, int COUNT)

2. Use the static method: static String copyValueOf (char [] Data) , static String copyValueOf (char [] Data, int offset, int COUNT)

7. The string of characters transformed into an array: toCharArray ()

8. The basic data types converted to a string: String.valueOf () ----- string transfected int : the Integer.parseInt ()

9.替换:String replace(char oldChar, char newChar)

10. Gets string: String substring (int the beginIndex) , String substring (int the beginIndex, int endIndex) : does not include the right border

11. Case Conversion: String toLowerCase () , String toUpperCase ()

12. White spaces across the string: String TRIM ()

13. dictionary Compares two strings: int the compareTo (String anotherString)

14. Cutting: String [] Split (String)

StringBufferStringBuilder

The variable string: StringBuffer (thread-safe), the StringBuilder (thread-safe)

* A thread is the smallest unit of work

* Software update function: increased functionality; modify bug ; increased security; enhance the user experience

StringBuffer sb = new StringBuffer ( "sb "); // can pass String parameter

Common methods:

1. From the last inserted element: the StringBuffer the append (Boolean B)

2. from the specified position of the insert elements: the StringBuffer INSERT (int offset, Boolean B)

3. To delete part of a string: StringBuffer the Delete (Start int, int End)

4. To delete a character: StringBuffer deleteCharAt (int index)

5. Alternatively substring specified: the StringBuffer Replace (int Start, End int, String STR)

6. modify a character: void setCharAt (int index, char CH)

7. acquisition: char charAt (int index)

8 from left to right Returns the specified substring index: int the indexOf (String STR)

9. Returns the length (number of characters): int length ()

10. Reverse: the StringBuffer Reverse ()

Site

实现客户端与服务器的通信

网址:协议+域名+端口+资源在服务器的路径+查询条件

http协议:超文本传输协议

https协议:安全的http协议

作业:切割网址

日期类Date

Date date = new Date();//获取当前时间(西方日期格式)

Date date = new Date(3000);//获取当前时间(西方日期格式)

获取long型的时间,从1970年开始计算的毫秒数

long time = date.getTime;//毫秒

日期格式转换器:

```java

//1.使用系统提供的默认的格式-DateFormat--提供了四种可选模式:short,long,full,default

//第一个参数用于指定日期格式   第二个参数用于指定时间格式

DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);

String stringDate =  dateFormat.format(new Date());

System.out.println(stringDate);

//1993-02-03 23:23:12     1993/02/03 23:23:12

//2.使用自定义的日期格式转换器实现自由转换----SimpleDateFormat

//"E yyyy.MM.dd 'at' hh:mm:ss a zzz"

SimpleDateFormat simpleDateFormat = new  SimpleDateFormat("yyyy/MM/dd  HH:mm:ss");//HH代表24小时制

String stringDate1 = simpleDateFormat.format(new Date());

System.out.println(stringDate1);

```

日历类Calendar

Calendar calendar = Calendar.getInstance();

| Calendar.YEAR         | 年份                           |

| --------------------- | ------------------------------ |

| Calendar.MONTH        | 月份                           |

| Calendar.DATE         | 日期                           |

| Calendar.DAY_OF_MONTH | 日期,和上面的字段意义完全相同 |

| Calendar.HOUR         | 12小时制的小时                 |

| Calendar.HOUR_OF_DAY  | 24小时制的小时                 |

| Calendar.MINUTE       | 分钟                           |

| Calendar.SECOND       | 秒                             |

| Calendar.DAY_OF_WEEK  | 星期几                         |

#### 权限修饰符:

private:同一个类

默认(default/friendly):同一个包

protected:同一个包、不同包的所有继承关系

public:所有都能访问

数组工具类Arrrays

内部封装了大量操作数组的静态方法:

toString(arr):简单数据类型数组转字符串

asList(arr):简单数据类型数组转集合,将整个数组作为1个元素

asList(strings):引用数据类型数组转集合,一个数组元素对应一个元素

数组转过来的集合长度固定,不能执行增加,删除,可以执行修改,遍历

binarySearch(arr,key);//二分查找

正则表达式

qq = "4446512";

String regex = "[1-9]\\d{4,12}";

boolean istrue = qq.matches(regex);

[]:限定某一位,能取到的值的范围

\d:代表数字

{}:限定个数

匹配:matches(regex); 切割:split(regex);

替换:replaceAll(regex,place)

```

正则表达式:

预定义字符:

匹配任何字符(与行结束符可能匹配可能不匹配)

\d 数字[0-9]  

\D 非数字 [^0-9]  

\s 空白字符 [ \t \n \x0B \f \r]

\S 非空白字符 [^\s]

\w 单词字符[a-z A-Z _ (下划线) 0-9]

\W 非单词字符[^\w]

注意 任何预定义字符没有没有加上数量词之前都只能匹配一个字符而已

数量词

X   一次或者一次都没有

X* 零次或多次

X+ 一次或多次

X{n} 恰好n

X{n,} 至少n

X{n,m} 至少n次,不超过m

范围词:

[abc]  a, b, c中的一个

[^abc] 任何字符 除了 a b c

[a-zA-Z] az AZ 两头的字母包括在内

[a-d[m-p]] ad mp[a-dm-p](并集)

注意 范围次不管有多长,没有数量词只能匹配一个字符而已

```


Guess you like

Origin blog.51cto.com/14479068/2438793