ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[https://www.jianshu.com/p/63c20e87f88a](https://www.jianshu.com/p/63c20e87f88a) ~~~ // 插入排序 private void sort(int[] arr) { if (null == arr || 0 == arr.length) { return; } int preIndex, cur; for (int i = 0; i < arr.length; i++) { preIndex = i - 1; cur = arr[i]; while (preIndex >= 0 && cur < arr[preIndex]) { arr[preIndex + 1] = arr[preIndex]; preIndex--; } arr[preIndex + 1] = cur; } } ~~~