- 浏览: 86259 次
- 性别:
- 来自: 武汉
最新评论
-
wml199039:
liguocai2009 写道wml199039 写道ligu ...
原子变量(AtomicLong, AtomicInteger, AtomicReference) -
liguocai2009:
wml199039 写道liguocai2009 写道原理是v ...
原子变量(AtomicLong, AtomicInteger, AtomicReference) -
wml199039:
liguocai2009 写道原理是volatile错误!
原子变量(AtomicLong, AtomicInteger, AtomicReference) -
nanjiwubing123:
...
约瑟夫环问题的java算法 -
liguocai2009:
不是syn
原子变量(AtomicLong, AtomicInteger, AtomicReference)
文章列表
前几天从网上Down了一个Java版的QQ的程序,看了一下觉得还行,里面有许多的东西还是可以学习的,对于C/S模式的编程来说,我主要从中看了以下四点:
一、服务器端线程管理机制,服务器是用ServerSocket来进行线程的连接的,并且根据用户的ID和线程来进行管理。
二、用户面板的管理机制,是一个HashMap,其主要的思想和上面一条是一致的
三、文件的发送机制,谁接收谁负责建立服务的连接,然后返回到Server一个Message,里面有建立连接的参数和消息的类型。
四、消息的发送机制,其实现机制不是点对点的连接,而是经过服务器中转的方式,这一点和飞信是不同的
五、没有一定的加解密机制,即消息 ...
- 2009-05-11 11:45
- 浏览 1769
- 评论(2)
package qinglin.learn.arithmetic;
public class BigNumberCalculation
{
public static void main(String[] args)
{
// TODO Auto-generated method stub
int a[]=new int[]{5234,5678,2234,5678};
int b[]=new int[]{345,1458,3423,2345};
int c[]=new int[4];
BigNumberCalculation calculatio ...
- 2009-04-20 16:21
- 浏览 2198
- 评论(0)
package qinglin.learn.arithmetic;
import java.util.Random;
public class GetPi
{
public static void main(String[] args)
{
int N=10000000;
int sum=0;
Random random = new Random();
for(int i=0;i<N;i++)
{
double x = random.nextDouble();
double y = random.nextDoubl ...
- 2009-04-20 11:05
- 浏览 1912
- 评论(0)
package qinglin.learn.arithmetic;
import java.util.Random;
public class PokerRefreash
{
public static void main(String[] args)
{
PokerRefreash refreash = new PokerRefreash();
Random random = new Random();
int poker[]=new int[53];
for(int i=1;i<poker.length;i++)
poker[i] ...
- 2009-04-20 10:52
- 浏览 1787
- 评论(1)
package qinglin.learn.arithmetic;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class LifeGame
{
private boolean[][] map;
private boolean[][] newmap;
public LifeGame(int maxRow, int maxColumn)
{
map = new boolean[maxRow][ma ...
- 2009-04-20 09:11
- 浏览 1275
- 评论(0)
package qinglin.learn.arithmetic;
public class SortsServices
{
public static void main(String args[])
{
SortsServices.sortIntoAction(1);
}
/**
* 交换值,交换数组的两个值
* @param array
* @param i
* @param j
*/
private static void swap(int[] array, int i, int j)
{
...
- 2009-04-19 16:43
- 浏览 962
- 评论(0)
package qinglin.learn.arithmetic;
public class QuickSort
{
public static void quickSort(int[] a)
{
qSort(a, 0, a.length - 1);
}
/**
* 对下标从s到t的元素进行快速排序。
*/
public static void qSort(int[] a, int s, int t)
{
if (s < t)
{
int pivot = partition(a, s, t);
...
- 2009-04-19 16:42
- 浏览 901
- 评论(0)
package qinglin.learn.arithmetic;
public class GetMinMultiple
{
@SuppressWarnings("static-access")
public static void main(String[] args)
{
new GetMinMultiple().getMinMultiple(6, 8);
}
public static void getMinMultiple(int a,int b)
{
int m=a>b?a:b;
int n=a<b?a ...
- 2009-04-19 16:41
- 浏览 2119
- 评论(1)
package qinglin.learn.arithmetic;
public class SackPro_02
{
int p[] =new int[]{9,10,7,4};
int w[] =new int[]{3,5,2,1};
int cp[]=new int[p.length];
int cw[]=new int[w.length];
int x[]=new int[p.length];
int cx[]=new int[p.length];
int currentP,currentW,bestp;
p ...
- 2009-04-19 16:39
- 浏览 883
- 评论(0)
package qinglin.learn.arithmetic;
public class SackPro_01
{
public static void main(String[] args)
{
int[] src = { 2, 4, 5, 7, 10 };
select(18, src, 0, new int[src.length]);
}
/**
* @param total 总数
* @param src 源数据数组
* @param offset 源数组的起始位置
* @param bag 背包,装选中的数 ...
- 2009-04-19 16:38
- 浏览 1214
- 评论(0)
package qinglin.learn.arithmetic;
import java.awt.*;
import javax.swing.*;
public class Pascal extends JFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;
@SuppressWarnings("deprecation")
public Pascal()
{
setBackground(Color.white);
setTitle(&q ...
- 2009-04-19 16:37
- 浏览 1335
- 评论(0)
package qinglin.learn.arithmetic;
public class MousedMaze_All
{
//2 代表的是墙壁,1代表的是路径,0代表的是可以行走的方格
int maze[][] =
{
{2, 2, 2, 2, 2, 2, 2},
{2, 0, 0, 0, 0, 0, 2},
{2, 0, 2, 0, 2, 0, 2},
{2, 0, 0, 2, 0, 2, 2},
{2, 2, 0, 2, 0, 2, 2},
{2, 0, 0, 0, 0 ...
- 2009-04-19 16:36
- 浏览 995
- 评论(0)
package qinglin.learn.arithmetic;
public class MousedMaze
{
//2 代表的是墙壁,1代表的是路径,0代表的是可以行走的方格
int maze[][] =
{
{2, 2, 2, 2, 2, 2, 2},
{2, 0, 0, 0, 0, 0, 2},
{2, 0, 2, 0, 2, 0, 2},
{2, 0, 0, 2, 0, 2, 2},
{2, 2, 0, 2, 0, 2, 2},
{2, 0, 0, 0, 0, 0, ...
- 2009-04-19 16:35
- 浏览 1003
- 评论(0)
package qinglin.learn.arithmetic;
public class ThreeColorFlag
{
public static void main(String[] args)
{
char color[] = {'b', 'w', 'b', 'w', 'w',
'b', 'r', 'b', 'w', 'r'};
int wFlag=0;
int bFlag=0;
int rFlag=color.length-1;
ThreeColorFlag demo=new ThreeColorFlag();
de ...
- 2009-04-19 16:35
- 浏览 1622
- 评论(0)
package qinglin.learn.arithmetic;
import java.util.ArrayList;
public class Josephus
{
private static int removeNM(int n, int m)
{
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 1; i <=n; i++)
{
list.add(new Integer(i));
}
int removed = 0; ...
- 2009-04-19 16:34
- 浏览 1789
- 评论(1)