`
foxinmy
  • 浏览: 5896 次
  • 性别: Icon_minigender_1
  • 来自: 湘
社区版块
存档分类
最新评论
文章列表
/** * 交换变量 */ static void changeField() { int i = 5; int j = 10; i = i + j; j = i - j; i = i - j; System.out.println("i:" + i + "\tj:" + j); } static void changeField1() { int i = 5; int j = 10; int temp = i; i = j; j = temp; Syst ...
/** * 算法 :求1-2+3-4+5+.....+m * * @param m */ static void suanfa1(int m) { int result = 0; if (m % 2 == 0) { result = -m / 2; } else { result = (m + 1) / 2; } System.out.println(result); } /** * 算法:求1、1、2、3、5、8、13、21、34.....的m位 * * @param m */ ...
/** * 打印图形 * eg: * @param m */ static void printGraph(int m) { for (int i = 1, j = 0; i <= m;) { if (i <= m / 2) { if (j < (2 * i - 1)) { System.out.print("*"); j++; continue; } } else if (i == (m + 1) / 2) { if (j < ( ...
/** * 数组排序(冒泡) * eg:[2,3,1] => [1,2,3] * @param array */ static void bubbleSort(int[] array) { // 临时变量 int temp; // 循环排序 for (int i = 0; i < array.length - 1; i++) { // 最大的元素交换到最后 for (int j = 0; j < array.length - 1 - i; j++) { // 交换元素 if (arra ...
  /** * 反转字符串 * eg:"abc" => "cba" * @param str */ static void reverseString(String str) { // 目标字符串转换为字符数组 char[] charArray = str.toCharArray(); // 获取转换后的字符数组长度 int charLength = charArray.length; char char_temp;// 临时字符变量 // 反转后的字符串 String newS ...
     前言:初次发帖,此文为maven的初级文章,老鸟飞过。(java技术交流群:178547149)        引子:maven是一款基于项目对象模型(POM)的项目构建工具,可以轻松的帮助开发人员构建项目,生成站点,打包jar等操作,鄙人对maven不算很深入,言多必失,o(︶︿︶)o 。   一、环境设置(Windows)      1.在此之前请确保本机已安装jdk,并配置好了环境变量。所谓环境设置就是使maven的相关命令能在dos下识别,下载maven压缩包。直接解压到某一目录下,其中    ---bin目录:包含运行maven命令的脚本;    ---boo ...
Global site tag (gtag.js) - Google Analytics