- 1
while (r == BigInteger.ONE.subtract(BigInteger.ONE)) {...}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+85
while (r == BigInteger.ONE.subtract(BigInteger.ONE)) {...}
брутальный 0 и не менее брутальное сравнение объектов...
+69
public static Integer valueOf(int i) {
if(i >= -128 && i <= IntegerCache.high)
return IntegerCache.cache[i + 128];
else
return new Integer(i);
}
Код java.lang.Integer
из этого как минимум следует что: Integer.valueOf(-130) != Integer.valueOf(-130).
+85
if( str.substring(0,3).equals("110")){
//restarting client
c.close();
Thread.sleep(100);
main(args);
System.gc();
System.exit(1);
}
Brutal restart
+75
...
<target name="killServer">
<exec executable="pkill">
<arg line=" java"/>
</exec>
<sleep seconds="1"/>
</target>
<target name="zipBuild">
<zip destfile="${home}/zipContent_${current.time}.zip"
basedir="${home}/${dir}"
update="true"
/>
</target>
<target name="all" depends="killServer, zipBuild" />
...
it's ant but... no ant in drop down (killing java with ant itself)
+80
for(xi=-aGraph/2-x0;xi<aGraph/2-x0;xi++){
if((2*A*K*(xi-Cx)+2*B*(M*xi-Cy))*(2*A*K*(xi-Cx)+2*B*(M*xi-Cy))-4*(A*K*K+B)*(A*(xi-Cx)*(xi-Cx)-Ck+B*(M*xi-Cy)*(M*xi-Cy))>=0)
yi=(-(2*A*K*(xi-Cx)+2*B*(M*xi-Cy))+(int)(Math.sqrt((2*A*K*(xi-Cx)+2*B*(M*xi-Cy))*(2*A*K*(xi-Cx)+2*B*(M*xi-Cy))-4*(A*K*K+B)*(A*(xi-Cx)*(xi-Cx)-Ck+B*(M*xi-Cy)*(M*xi-Cy)))))/(2*(A*K*K+B));
if (xi+xx>xGraph&&xi+xx<xGraph+aGraph&&-yi + yy>yGraph&&-yi + yy<yGraph+bGraph&&
(2*A*K*(xi-Cx)+2*B*(M*xi-Cy))*(2*A*K*(xi-Cx)+2*B*(M*xi-Cy))-4*(A*K*K+B)*(A*(xi-Cx)*(xi-Cx)-Ck+B*(M*xi-Cy)*(M*xi-Cy))>=0) {
g.drawLine(xi + xx, -yi + yy, xi + xx, -yi + yy);
if(m==1)
g.fillOval(xi + xx-1,-yi + yy-1,2,2);
}
}
+76
for (int j = 0; j < fieldsToRemove.size(); j++) {
if (fieldsToDelete.getField(j).getKind().equals("GroupField")) {
resFieldContr.remove(j--);
}
}
собственно цикл.
нашел в рабочем проекте
+84
http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
/*
* Copyright 2003-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.groovy.runtime;
public class ArrayUtil {
private static final Object[] EMPTY = new Object[0]
;
public static Object[] createArray() {
return EMPTY;
}
public static Object[] createArray(Object arg0) {
return new Object[]{
arg0};
}
public static Object[] createArray(Object arg0, Object arg1) {
return new Object[]{
arg0, arg1};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2) {
return new Object[]{
arg0, arg1, arg2};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3) {
return new Object[]{
arg0, arg1, arg2, arg3};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4, arg5};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4, arg5, arg6};
}
............
+70
if(url.getProtocol().equals("http") || true)
{
// ...
}
Индийский код добрался и до Android...
+71
private void init() {
if(file != null) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line;
int delimeterPosition = 0;
while((line = reader.readLine()) != null) {
//drop empty lines
if(line.trim().isEmpty() || line.trim().startsWith(";") || line.trim().startsWith("//")) continue;
if((delimeterPosition = line.indexOf("=")) != -1) {
//drop values without keys
if(line.substring(0, delimeterPosition-1).trim().isEmpty()) continue;
hm.put(line.substring(0, delimeterPosition-1).trim(), line.substring(delimeterPosition));
}
}
} catch (IOException ex) {
trouble = true;
}
}
}
велосипеды-велосипедики.
+78
fm.bottom += ( tempBottom - fm.bottom );
fm.descent += ( tempDescent - fm.descent );
fm.ascent += ( tempAscent - fm.ascent );
fm.top += ( tempTop - fm.top );