天天看點

IntelliJ Idea 工具

 IntelliJ Idea 優化:

1.如何取消檔案自動儲存

File->Settings -> Appearance&Behavior -> System Settings标簽項裡

取消“Synchronize file on frame activation” 和“Save files on framedeactivation”的選擇

同時我們選擇"Save files automatically", 并将其設定為30秒,這樣IDEA依然可以自動儲存檔案,也就是在30s内不會幫你自動儲存檔案,需要手動ctrl+s儲存,超過30s會自動幫你儲存。

IntelliJ Idea 工具

如果想讓修改時,在檔案右邊顯示*号标志,File->Settings -> Editor –> General ->Editor Tabs

選中"Mark modifyied tabs with asterisk"

IntelliJ Idea 工具

2.如何讓代碼編輯區顯示行号

File->Settings->Editor->Appearance标簽項,勾選Show line numbers

IntelliJ Idea 工具

3.如何設定字型

File->Settings->Editor->Colors&Fonts->Font标簽項,預設是無法修改字型的,需要先點選Save As...,會彈出一個對話框,然後命名自己的名字,點選OK,即可編輯字型了,也可以設定控制台字型。

IntelliJ Idea 工具

4.如何讓IntelliJ IDEA動的時候不打開工程檔案

File->Settings -> Appearance&Behavior -> System Settings标簽項裡去掉Reopen last project on startup即可

IntelliJ Idea 工具

編碼設定

FILE -> SETTINGS -> FILE ENCODINGS -> IDE ENCODING

FILE -> SETTINGS -> FILE ENCODINGS -> DEFAULT ENCODING FOR PROPERTIES FILES

FILE -> SETTINGS -> COMPILER -> JAVA COMPILER -> ADDITIONAL COMMAND LINE PARAMETERS

顯示行号 

如何顯示行号:Settings->Editor->Appearance标簽項,勾選Show line numbers

自定義鍵盤快捷方式 

如果預設代碼提示和補全快捷鍵跟輸入法沖突,如何解決:Settings->Keymap

如何讓光标不随意定位 

Settings->Editor中去掉Allow placement of caret after end of line。  

部分常用快捷鍵:

Intellij idea

作用

查找

Ctrl+F

查找

Ctrl+R

替換

F3

查找下一個

Shift+F3

查找上一個

Ctrl+Shift+F

在路徑中查找

Ctrl+Shift+R

在路徑中替換

代碼

Alt+Insert

代碼生成器(編輯器視圖),建立檔案(導航視圖)

Ctrl+J

常用代碼如:psvm/sout,main/System.out.println(); 

Ctrl+空格

代碼提示(與系統輸入法快捷鍵沖突)

alt+enter

快速修複

Ctrl+Alt+T

可以把代碼包在一個塊内,例如:try/catch

Ctrl+P

可以顯示方法參數資訊

Ctrl+O

提示可重寫方法

Ctrl+I

自動實作接口方法

Ctrl+Shift+Space

自動補全代碼

Ctrl+Alt+Space

類名自動完成

類檔案

Ctrl+F7

顯示目前檔案的結構

Ctrl+H

顯示類結構圖(類的繼承層次)

Alt+F1

查找代碼所在位置

Ctrl+N

可以快速打開類

Ctrl+Shift+N

可以快速打開檔案

Ctrl+B/Ctrl+Click

跳轉到方法内

Ctrl+Alt+B

跳轉到方法的實作處

Ctrl+U

跳轉到父類

編輯

Ctrl+D

複制行

Ctrl+X

剪切目前行

Ctrl+Y

删除目前行

Ctrl+/或Ctrl+Shift+/

注釋(//或者/**/)

Ctrl+G

定位行

Ctrl+[ OR ]

可以跑到大括号的開頭與結尾

Alt+Up/Down

在方法間快速移動定位

Alt+left/right

切換代碼視圖

F2 或 Shift+F2

快速定位錯誤處

Shift+Enter

向下插入一行,并将光标移到新行

Shift+Alt+Enter

向上插入一行,并将光标移到新行

Alt+Shift+Up/Down

向上/下移動語句

Ctrl+Shift+Up/Down

向上/下移動語句(隻在方法内)

Ctrl+Shift+J

整合縮進上下兩行

Ctrl+W

可以選擇單詞繼而語句繼而行繼而函數

Ctrl+Shift+W

取消選擇光标所在詞

Alt+Shift+Insert

開啟多列同時編輯功能,用ctrl+up/down選中

Ctrl+Alt+left/right

傳回至上次浏覽的位置

Ctrl+Shift+Backspace

跳轉到上次編輯的地方

Ctrl+E

最近的檔案

Ctrl+Shift+E

最近更改的檔案

系統編輯

Alt+Left/Right

往左、往右跳走一個單詞

Alt+Shift+Left/Right

往左、往右跳選一個單詞

Alt+Backspace

删除一個單詞

調試

F7

步入

F8

步過

F9

下一個斷點

Shift+F7

智能步入

Shift+F8

步出

Alt+F8

計算表達式

Alt+F9

運作至光标處

Alt+F10

定位到斷點

Ctrl+F8

切換行斷點(添加取消斷點)

Ctrl+Shift+F8

檢視斷點,可以添加斷點條件

重構

Shift+F6

重命名

Ctrl+Alt+Shift+T

彈出重構菜單

輔助

Ctrl+Enter

導入包,自動修正

Ctrl+Alt+L

格式化代碼

Ctrl+Alt+O

優化導入的類和包

Ctrl+Alt+Shift+S

打開項目子產品設定

Ctrl+Alt+S

打開設定對話框

破解注冊碼檔案代碼:

import java.math.BigInteger;

import java.util.Date;

import java.util.Random;

import java.util.Scanner;

import java.util.zip.CRC32;

public class KeyGen {

    public static short getCRC(String s, int i, byte bytes[]){

        CRC32 crc32 = new CRC32();

        if (s != null)

        {

            for (int j = 0; j < s.length(); j++)

            {

                char c = s.charAt(j);

                crc32.update(c);

            }

        }

        crc32.update(i);

        crc32.update(i >> 8);

        crc32.update(i >> 16);

        crc32.update(i >> 24);

        for (int k = 0; k < bytes.length - 2; k++)

        {

            byte byte0 = bytes[k];

            crc32.update(byte0);

        }

        return (short) (int) crc32.getValue();

    }

    public static String encodeGroups(BigInteger biginteger){

        BigInteger beginner1 = BigInteger.valueOf(0x39aa400L);

        StringBuilder sb = new StringBuilder();

        for (int i = 0; biginteger.compareTo(BigInteger.ZERO) != 0; i++)

        {

            int j = biginteger.mod(beginner1).intValue();

            String s1 = encodeGroup(j);

            if (i > 0)

            {

                sb.append("-");

            }

            sb.append(s1);

            biginteger = biginteger.divide(beginner1);

        }

        return sb.toString();

    }

    public static String encodeGroup(int i){

        StringBuilder sb = new StringBuilder();

        for (int j = 0; j < 5; j++)

        {

            int k = i % 36;

            char c;

            if (k < 10)

            {

                c = (char) (48 + k);

            }

            else

            {

                c = (char) ((65 + k) - 10);

            }

            sb.append(c);

            i /= 36;

        }

        return sb.toString();

    }

    public static String MakeKey(String name, int days, int id){

        id %= 100000;

        byte bkey[] = new byte[12];

        bkey[0] = (byte) 1; // Product type: IntelliJ IDEA is 1

        bkey[1] = 14; // version

        Date d = new Date();

        long ld = (d.getTime() >> 16);

        bkey[2] = (byte) (ld & 255);

        bkey[3] = (byte) ((ld >> 8) & 255);

        bkey[4] = (byte) ((ld >> 16) & 255);

        bkey[5] = (byte) ((ld >> 24) & 255);

        days &= 0xffff;

        bkey[6] = (byte) (days & 255);

        bkey[7] = (byte) ((days >> 8) & 255);

        bkey[8] = 105;

        bkey[9] = -59;

        bkey[10] = 0;

        bkey[11] = 0;

        int w = getCRC(name, id % 100000, bkey);

        bkey[10] = (byte) (w & 255);

        bkey[11] = (byte) ((w >> 8) & 255);

        BigInteger pow = new BigInteger("89126272330128007543578052027888001981", 10);

        BigInteger mod = new BigInteger("86f71688cdd2612ca117d1f54bdae029", 16);

        BigInteger k0 = new BigInteger(bkey);

        BigInteger k1 = k0.modPow(pow, mod);

        String s0 = Integer.toString(id);

        String sz = "0";

        while (s0.length() != 5)

        {

            s0 = sz.concat(s0);

        }

        s0 = s0.concat("-");

        String s1 = encodeGroups(k1);

        s0 = s0.concat(s1);

        return s0;

    }

    public static void main(String[] args){

        System.out.println("請輸入使用者名:");

        Scanner scanner = new Scanner(System.in);

        String username = scanner.next();

        Random r = new Random();

        System.out.println(MakeKey(username, 0, r.nextInt(100000)));

    }

}