static boolean buildTree()
	{
		double min1, min2;
		int i, j, minat1, minat2;
		HuffmanNode[] work = new HuffmanNode[256];
		HuffmanNode tmp = new HuffmanNode();
		for(i = 0;i < 256;i++)
		{
			work[i] = myWork[i];
			work[i].val = (char) i;
			work[i].freq = freq[i];
			work[i].zero = null;
			work[i].one = null;
			huffLookup[i].len = 0;
		}
		for(i = 0;i < 255;i++)
		{
			minat1 = -1;
			minat2 = -1;
			min1 = 1E30;
			min2 = 1E30;
			for(j = 0;j < 256;j++)
			{
				if(work[j] == null)
					continue;
				if(work[j].freq < min1)
				{
					minat2 = minat1;
					min2 = min1;
					minat1 = j;
					min1 = work[j].freq;
				}
				else if(work[j].freq < min2)
				{
					minat2 = j;
					min2 = work[j].freq;
				}
			}
			if(minat1 < 0)
			{
				System.out.println("Huffman init error: minat1: " + minat1);
				return false;
			}
			if(minat2 < 0)
			{
				System.out.println("Huffman init error: minat2: " + minat2);
				return false;
			}
			tmp = myTmp[i];
			tmp.zero = work[minat2];
			tmp.one = work[minat1];
			tmp.freq = work[minat2].freq + work[minat1].freq;
			tmp.val = 0xFF;
			work[minat1] = tmp;
			work[minat2] = null;
		}
		huffTree = tmp;
		return findTab(huffTree, 0, 0);
	}