Code->Reformate Code
把代碼從新格式化,再研究一下Code菜單。Settings ->Plugins -> Browse repositories...
在搜索框輸入alibaba
便可看到Alibaba Java Code Guidelines
插件,點擊Install
進行安裝,而後重啓IDEA生效Code
菜單功能
Override Methods
:重載方法/新建方法Implement Methods
:執行方法Generate
:建立類裏面任何字段的getter
與setter
方法Surround with
:將某條語句被if、for等等封裝語句括起Move Statement Down/up
:將語句下移到後一模塊以後Move line down
:調換語句順序Comment with Line/Block Comment
:兩種註釋Reformat Code
:將代碼按標準格式縮進git add .
、git commit -m "本身學號 添加內容"
、git push
管理->項目成員管理->添加項目成員->邀請組織成員
git clone 搭檔碼雲連接
vim 類名.java
Refactor
菜單各功能/** * @Date 2018/4/28 * @author wangyaojia */ public class Caesar{ public static void main(String []args) throws Exception{ String s=args[0]; int key=Integer.parseInt(args[1]); String es=""; for(int i=0;i<s.length( );i++) { char c=s.charAt(i); // 是小寫字母 c = getC(key, c); es+=c; } System.out.println(es); } private static char getC(int key, char c) { if(c>='a' && c<='z') { //移動key%26位 c = move(key, c); if(c<'a') { //向左超界 c = changeCplus(c); } if(c>'z') { //向右超界 c = changeCminus(c); } } // 是大寫字母 else if(c>='A' && c<='Z') { c = move(key, c); if(c<'A') { c = changeCplus(c); } if(c>'Z') { c = changeCminus(c); } } return c; } private static char changeCminus(char c) { c -= 26; return c; } private static char changeCplus(char c) { c += 26; return c; } private static char move(int key, char c) { c+=key%26; return c; } }
運行結果
html
Java摘要算法- MD5java
import java.security.*; /** * Demo class * * @author zyx * @date 2018/04/28 */ public class DigestPass{ public static void main(String[ ] args) throws Exception{ String x = getString(args[0]); MessageDigest m=MessageDigest.getInstance("MD5"); m.update(x.getBytes("UTF8")); byte[] s = getDigest(m); String result=""; for (int i=0; i<s.length; i++){ result+= getString(s[i]).substring(6); } System.out.println(result); } private static String getString(byte b) { return Integer.toHexString((0x000000ff & b) | 0xffffff00); } private static byte[] getDigest(MessageDigest m) { return m.digest(); } private static String getString(String arg) { return arg; } }
在下載alibaba插件時出現
git
解決方法:應該是網絡鏈接的問題,轉換網絡後下載成功。在查詢資料時,我找到了阿里巴巴Java開發規約IDEA插件安裝及使用,這裏提供了兩種下載方法。算法
在進行團隊項目時,老師要求將搭檔能夠添加代碼到本身的項目中,咱們認爲是在本身原進行git的文件下進行git clone
,結果在搭檔碼雲中出現個人碼雲文件而且打不開編程
解決方法:需新建一個全新的文件夾,進行
git clone
,再轉到要添加代碼的搭檔目錄下進行vim 類名.java
vim
步驟 | 耗時 | 百分比 |
---|---|---|
需求分析 | 15分鐘 | 9% |
設計 | 90分鐘 | 49% |
代碼實現 | 20分鐘 | 10% |
測試 | 30分鐘 | 16% |
分析總結 | 30分鐘 | 16% |