一、封装的类(来源于codeproject):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace WpfApplication1
{
JDK6的源码:
/**
* Returns a hash code for this string. The hash code for a
* String object is computed as
*
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
*
// 将字符串转成hash值
public static int toHash(String key) {
int arraySize = 11113; // 数组大小一般取质数
int hashCode = 0;
for (int i = 0; i < key.length(); i++) { // 从