- 博客(13)
- 收藏
- 关注
原创 Java库源码之Java.lang.Integer类方法-parseInt(String s)分析
在介绍parseInt(String s)方法之前,首先进行一个基本的字符串到整型的转换:import java.util.regex.Matcher;import java.util.regex.Pattern;public class TestDemo { public static void main(String[] args) { // TODO Auto-gener
2016-08-26 21:56:33
1353
原创 堆排序之java实现
排序算法之堆排public class HeapSorting{ public static int LeftChild(int i){ return 2*i+1; } static void PercDown(int A[],int i,int N){ int Child; int Tmp; for(Tmp=A[i];LeftChild(i)<N;i=Child){
2016-08-26 17:45:41
448
原创 二叉排序树之Java实现
二叉排序树查找import java.util.Arrays;class BinaryTree{ private class Node{ @SuppressWarnings("rawtypes") private Comparable data; private Node left; private Node right; public Node(@SuppressW
2016-08-26 17:07:48
463
原创 冒泡排序、直接插入排序及选择排序之Java实现
1,排序算法之冒泡排序public class BubbleSorting { public static void main(String[] args) { // TODO Auto-generated method stub int iArray[]={12,1,3,2,32,21,41,12,0}; //upBubble(iArray,iArray.length);
2016-08-26 17:01:17
519
原创 快排之Java实现
public class QuickSorting { public static void main(String[] args) { int iArray[]={12,1,3,2,32,21,41,12,0}; int len=iArray.length; sort(iArray,0,len-1); for(int a:iArray){ System.out
2016-08-26 16:57:57
446
原创 网易有道笔试编程之队列构造
题目:小明同学把1到n这n个数字按照一定的顺序放入了一个队列Q中。现在他对队列Q执行了如下程序:while(!Q.empty()){ int x=Q.front(); //取出当前队头的值x Q.pop(); //弹出当前队头 Q.push(x); //取出这时候队头的值 print("%d\n",x); /
2016-08-18 17:21:44
1215
原创 JNI(Java Native Interface)首次使用
1,首先编写Java源代码,因为需要调用本地方法“displayHelloWorld“(由C++实现),所以在Java源码中用native修饰;public class HelloWorld { public native void displayHelloWorld(); static{ System.loadLibrary("hello"); } public static
2016-07-25 10:39:22
730
原创 Java EE中关于配置文件web.xml杂谈一
当我们启动一个web项目时,容器Tomcat(运行在虚拟机上)首先会先获取配置文件web.xml中的配置信息,所以当web.xml中出现错误时,无论运行在服务器上的是servlet,还是JSP(jsp最终被Tomcat翻译成servlet,位于%CATALINE_HOME%\work\Catalina\localhost\*web应用名*\org\apache\jsp),均无法正确显示。
2016-05-18 20:37:27
1891
原创 Swap Nodes in Pairs Java实现
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space.
2016-05-13 15:01:56
449
原创 免安装版数据库MySQL-5.7.12-winx64下载、安装及配置和使用
一、MySQL下载 1,首先在MySQL官网下载,http://dev.mysql.com/downloads/mysql/点击打开链接。这里有安装版(installer MSI)以及免安装版(zip archive)两种。其中安装版就是文件解压缩后得到一个可执行文件,打开后根据一系列提示就可完成软件的安装(安装版会在电脑注册表中写入信息,而免安装版不会)。免安装版也就是绿色软件,解压后
2016-04-22 15:54:42
5987
原创 leetcode70-Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?/***方法一:采用排列组合(发现当台阶数n增大时,递归结果产生
2016-03-09 21:33:11
307
原创 Android开发中,关于心跳包的简要介绍
心跳包的作用主要是在客户端与服务器端通信时,保持两者间的长连接。但是为什么长链接需要心跳包来维系呢?主要由于客户端与服务器端通信时会建立链路连接,当链路一段时间没有通信时,为了减少链路负荷、节省通道资源,链路会被中断。
2016-03-09 17:42:23
1238
原创 Reverse words in a string by java
题目:输入一个字符串,然后逐词的转换其顺序。例如s="the sky is blue",则要求输出s="blue is sky the"。代码public class Solution { public String reverseWords(String s) { s=s.trim();//去除首尾空格 if(s.indexOf(" ")==
2016-03-04 11:57:44
275
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人