# Line 面試考題 ```javascript= public class Solution { public static void main(String[] args) { char[] data = {'a','b','c'}; String str = ""; for(int i = 0 ; i <= 2 ; i++) { String str_idx = str + ""+data[i]; for(int j = 0 ;j <=2 ;j++) { String str_idx2 = str_idx +"" + data[j]; for(int k = 0 ; k <= 2 ;k++) { String str_idx3 = str_idx2 +"" + data[k]; System.out.println(str_idx3); } } } } } ``` --- ## CHAR 與 VARCHAR 做簡單的比較? > http://www.xpertdeveloper.com/2011/12/char-varchar-in-mysql/ > 容忍長度 * char: 0 ~ 255 * varchar: 0 ~ 65535 #### name CHAR(5) ``` --------------------------------------- value actual_storage Space --------------------------------------- 'ex' 'ex' 5 bytes 'exper' 'exper' 5 bytes 'expert' 'exper' 5 bytes --------------------------------------- ``` #### name VARCHAR(5) ``` --------------------------------------- value actual_storage Space --------------------------------------- 'ex' 'ex' 3 bytes 'expe' 'expe' 5 bytes 'expert' 'exper' 6 bytes --------------------------------------- ``` ## 差別 * char 只會存固定的長度,不管資料的長度為多少; varchar則會依據資料長度進行儲存 * varchar會多存1~2 個bytes紀錄資料長度,255 bytes以下存1byte,255以上存2個bytes --- ## Message Digest Message Digest 即是**一段訊息的摘要**,類似於 fingerprint(指紋) 的概念;理論上,不同的訊息所產生出來的 message digest 都不會是相同的,因此可以用來驗證訊息在傳輸的過程中是否有被竄改過。 而 message digest 是如何產生的呢? 在目前的作法中,是以複雜的 hash function (雜湊函數) 所計算出來,