一些自用的便捷工具,不定期更新

2021-08-30 17:19:35 字數 1986 閱讀 3903

自己專案裡用到的工具類,不定時更新

public final class speedykit 

/*** 獲取a(包含)與b(包含)之間的所有的自然數,步長為1.本方法會比較a和b的大小,然後公升序排列

* * @param a

* @param b

* @return

*/public static int stepdigits(int a, int b)

return array;

} /**

* 返回陣列的最後乙個元素

* * @param array

* @return

* @throws nullpointerexception

* 如果陣列為null

*/public static int lastofarray(int array)

return array[array.length - 1];

} /**

* 返回陣列的最後乙個元素

* * @param * @param array

* @return

* @throws nullpointerexception

* 如果陣列為null

*/public static t lastofarray(t array)

return array[array.length - 1];

} /**

* 反轉陣列

* * @param array 自然排序過的陣列

* @return

* @throws nullpointerexception

* 如果陣列為null

*/public static int reversearray(int array)

int newarray = new int[array.length];

for (int i = 0, j = array.length - 1; j >= 0; j--)

return newarray;

} /**

* 反轉陣列

* * @param * @param array 自然排序過的陣列

* @return

* @throws nullpointerexception

* 如果陣列為null

*/public static t reversearray(t array)

t newarray = arrays.copyof(array, array.length);

arrays.sort(newarray, collections.reverseorder());

return newarray;

} /**

* 計算位元組的md5

* @param array

* @return

*/public static string md5(byte array) ;

// 用位元組表示就是 16 個位元組

char result = new char[16 * 2]; // 每個位元組用 16

// 進製表示的話,使用兩個字元,

// 所以表示成 16 進製需要 32 個字元

int j = 0; // 表示轉換結果中對應的字元位置

for (int i = 0; i < 16; i++)

return new string(result);

} catch (nosuchalgorithmexception e)

return null;

} public static void main(string args)

t = speedykit.reversearray(t);

system.out.println(speedykit.lastofarray(t));

}}

Angular一些api的使用 不定期更新

最近公司要求學習angular,其實框架不難,但是就是裡面的一些api挺難記下來,所以想在這記錄一下api的使用方法來方便自己的查詢。例子 import from angular2 core component constructor inject forwardref service servic...

HTML常用小技能(自用,不定期更新)

1 文字溢位顯示 css3新增了text overflow屬性,該屬性可以設定超長文字省略顯示。text overflow屬性的基本語法如下 text overflow clip ellipsis ellipsis word p注意 想要實現 必須強制文字在一行內顯示 white space now...

c語言一些簡單的演算法 還會不定期更新

統計字串中字元個數 string 字串 int length char string return len 把字串中的數字提取出來 直接提取 string 字串 int getnum char string return num 把字串中的數字提取 相加 string 字串 int getnumsu...