概率归一化

@param c 数组元素必须大于等于0
340214
public static void normalize2Prop(float[] c) {
		float sum = sum(c);
		
		if (sum == 0)
			return;
		for (int i = 0; i < c.length; i++) {
			c[i] = c[i] / sum;
		}
	}
129874
public void write(final int c) throws IOException {
        if (c >= 0XDC00 && c <= 0XDFFF) {
            // Low surrogate
            this.surrogatePair.append((char) c);

            if (this.encoder.canEncode(this.surrogatePair)) {
                this.writer.write(this.surrogatePair.toString());
            } else {
                this.writer.write("&#x");
                this.writer.write(Integer.toHexString(0X10000 + ((this.surrogatePair.charAt(0) & 0X3FF) << 10) + (c & 0X3FF)));
                this.writer.write(';');
            }

            this.haveHighSurrogate = false;
            this.surrogatePair.setLength(0);
        } else {
            if (this.haveHighSurrogate) {
                this.haveHighSurrogate = false;
                this.surrogatePair.setLength(0);
                throw new IOException("High Surrogate not followed by Low Surrogate");
            }

            if (c >= 0XD800 && c <= 0XDBFF) {
                // High surrogate
                this.surrogatePair.append((char) c);
                this.haveHighSurrogate = true;

            } else if (!this.encoder.canEncode((char) c)) {
                this.writer.write("&#x");
                this.writer.write(Integer.toHexString(c));
                this.writer.write(';');
            } else if (c == '\'' && this.writingAttribute && !useDoubleQuotes) {
                this.writer.write("&apos;");
            } else if (c == '"' && this.writingAttribute && useDoubleQuotes) {
                this.writer.write("&quot;");
            } else if (c == '\n' && this.writingAttribute) {
                this.writer.write("&#10;");
            } else if (c == '\r' && this.writingAttribute) {
                this.writer.write("&#13;");
            } else if (c == '\t' && this.writingAttribute) {
                this.writer.write("&#09;");
            } else {
                this.writer.write(c);
            }
        }
    }
1025986
@Override
    public void write(final int c) {
        usageFlag = true;
        if (trouble)
            return;

        try {
            getOut().write(c);
        }
        catch (IOException e) {
            handleIOException(e);
        }
    }
1004834
@Override
	protected int pruneCache() {
		int count = 0;
		CacheObj<K, V> first = null;
		
		// 清理过期对象并找出链表头部元素（先入元素）
		Iterator<CacheObj<K, V>> values = cacheMap.values().iterator();
		while (values.hasNext()) {
			CacheObj<K, V> co = values.next();
			if (co.isExpired()) {
				values.remove();
				count++;
			}
			if (first == null) {
				first = co;
			}
		}

		// 清理结束后依旧是满的，则删除第一个被缓存的对象
		if (isFull() && null != first) {
			cacheMap.remove(first.key);
			onRemove(first.key, first.obj);
			count++;
		}
		return count;
	}
1240001
public static void close(@CheckForNull AutoCloseable c) {
        if (c == null) {
            return;
        }

        try {
            c.close();
        } catch (Exception e) {
            // Ignore
        }
    }
599218
public static int countNoneZero(float[] c) {
		int count = 0;
		for (int i = 0; i < c.length; i++) {
			if (c[i] != 0.0)
				count++;
		}
		return count;
	}
503479
private <T> void checkFormat(Collection<T> c) {
		Class<?> type = null;
		List<Class<?>> typeList = new ArrayList<Class<?>>();
		Iterator<T> it = c.iterator();
		while (it.hasNext()) {
			Object o = it.next();

			// check the input types for 1-dimension
			if (type != null && !type.equals(o.getClass())) {
				throw new RuntimeException("elements of input list should have the same type");
			}
			else {
				type = o.getClass();
			}

			// check the input types for 2-dimension array
			if (typeList.size() == 0 && o.getClass().isArray()) {
				for (Object s : (Object[]) o) {
					typeList.add(s.getClass());
				}
			}
			else if (o.getClass().isArray()) {
				int index = 0;
				if (((Object[]) o).length != typeList.size()) {
					throw new RuntimeException("elements of input list should have the same size");
				}
				for (Object s : (Object[]) o) {
					if (!s.getClass().equals(typeList.get(index++))) {
						throw new RuntimeException("elements of input list should have the same type");
					}
				}
			}

			// check the input types for 2-dimension collection
			if (typeList.size() == 0 && o instanceof Collection) {
				@SuppressWarnings("unchecked")
				Iterator<Object> tmpIt = ((Collection<Object>) o).iterator();
				while (tmpIt.hasNext()) {
					Object s = tmpIt.next();
					typeList.add(s.getClass());
				}
			}
			else if (o instanceof Collection) {
				int index = 0;
				@SuppressWarnings("unchecked")
				Iterator<Object> tmpIt = ((Collection<Object>) o).iterator();
				while (tmpIt.hasNext()) {
					Object s = tmpIt.next();
					if (!s.getClass().equals(typeList.get(index++))) {
						throw new RuntimeException("elements of input list should have the same type");
					}
				}

				if (index != typeList.size()) {
					throw new RuntimeException("elements of input list should have the same size");
				}
			}
		}
	}
1324449
private void pop( char c ) {
      if( this.top <= 0 || this.stack[this.top - 1] != c ){
         throw new JSONException( "Nesting error." );
      }
      this.top -= 1;
      this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1];
   }
1299890
public void write(int c) throws IOException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        { // 306998.15
            Tr.debug(tc, "write --> " + c);
        }

        if (!_hasWritten && obs != null)
        {
            _hasWritten = true;
            obs.alertFirstWrite();
        }

        if (limit > -1)
        {
            if (total >= limit)
            {
                throw new WriteBeyondContentLengthException();
            }
        }
        if (count == buf.length)
        {
            response.setFlushMode(false);
            flushChars();
            response.setFlushMode(true);
        }
        buf[count++] = (char) c;
        total++;
    }
1045103
public static boolean isEmpty(final Collection<String> c) {
        if (c == null || c.isEmpty()) {
            return false;
        }
        for (final String text : c) {
            if (isNotEmpty(text)) {
                return false;
            }
        }
        return true;
    }
151370
private void writeCharsToOut(char[] cbuf, int len) throws IOException {
		if(len > 0) {
			if(len == 1) {
				out.write(cbuf[0]);
			} else {
				out.write(cbuf, 0, len);
			}
		}
	}
1333067
private void connectOccs(final CLClause c) {
        assert this.dense;
        for (int i = 0; i < c.lits().size(); i++) { addOcc(c.lits().get(i), c); }
    }
328607
@SuppressWarnings("unchecked")
	
	/**
	 * 返回列表 key 中，下标为 index 的元素。
	 * 下标(index)参数 start 和 stop 都以 0 为底，也就是说，以 0 表示列表的第一个元素，
	 * 以 1 表示列表的第二个元素，以此类推。
	 * 你也可以使用负数下标，以 -1 表示列表的最后一个元素， -2 表示列表的倒数第二个元素，以此类推。
	 * 如果 key 不是列表类型，返回一个错误。
	 */
	public <T> T lindex(Object key, long index) {
		Jedis jedis = getJedis();
		try {
			return (T)valueFromBytes(jedis.lindex(keyToBytes(key), index));
		}
		finally {close(jedis);}
	}
903060
public void write(int c) {
        if (c != -1) {
            current.append((char)c);
        }
        if (c == '\n') {
            current = new StringBuffer();
            lines.add(current);
        }
    }
90819
private void write(int c) throws IOException {
		if (!firstCharacterWritten) {
			if (c != '\n') {
				out.write(c);
				firstCharacterWritten = true;
			}
		} else {
			out.write(c);
		}
	}
875323
@Override
  public void write (final int c) throws IOException
  {
    _ensureOpen ();
    if (m_nNextChar >= m_nChars)
      flushBuffer ();
    m_aBuf[m_nNextChar++] = (char) c;
  }
1093688
protected final void doInsert(Connection c) throws SQLException {
		PreparedStatement stmt = null;
		try {
			stmt = c.prepareStatement("insert into foo values (?, ?)  ");
			stmt.setInt(1, rand.nextInt(99999));
			stmt.setString(2, "This is a text");
			stmt.executeUpdate();
		} finally {
			if (stmt != null) {
				stmt.close();
			}
		}
	}