• ,

Говнокод #12

private String getIdString() {
        String answer = Integer.toHexString(id.intValue());
        switch (answer.length()) {
        case 0:
            answer = "00000000";
            break;
        case 1:
            answer = "0000000" + answer;
            break;
        case 2:
            answer = "000000" + answer;
            break;
        case 3:
            answer = "00000" + answer;
            break;
        case 4:
            answer = "0000" + answer;
            break;
        case 5:
            answer = "000" + answer;
            break;
        case 6:
            answer = "00" + answer;
            break;
        case 7:
            answer = "0" + answer;
            break;
        }
        return answer;
    }
  • ,

Говнокод #6

private void setTims( String project )
{
    int endIndex = project.indexOf( "-" );
    boolean isNumber = false;
    if ( endIndex != -1 )
    {
        try
        {
            Integer.parseInt( project.substring( 0, endIndex ) );
            isNumber = true;
        }
        catch ( NumberFormatException e )
        {
            //ignore
        }
    }
    if ( isNumber )
    {
        runtimeContext.put( RuntimeContext.TIMS_NUMBER, project.substring( 0, endIndex ) );
    }
    else
    {
        runtimeContext.put( RuntimeContext.TIMS_NUMBER, project );
    }
}