- 1
- 2
http://habrahabr.ru/post/263703/
https://github.com/veryEvilMan/fl-ru-damp/issues/3#issuecomment-125602470
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+69
http://habrahabr.ru/post/263703/
https://github.com/veryEvilMan/fl-ru-damp/issues/3#issuecomment-125602470
Так, признавайтесь, кто приложил потные ручонки.
+69
totOwed1 = BigDecimalUtils
.subtract(
BigDecimalUtils.subtract(
BigDecimalUtils.subtract(
BigDecimalUtils.subtract(
BigDecimalUtils.subtract(
BigDecimalUtils.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
BigDecimalUtils
.subtract(
hMoTotalPayAmt,
hClmPaperChrgAmt),
hRestitutionAmt),
hRestQaAmt),
hRestNmAmt),
hOverPaymentAmt),
hLevyAmt),
hSupportOrdAmt),
hBackUpWithhdAmt),
hEyefinDebitAmt),
hPrePaymentAmt),
hMoDebitsVsplab),
hMoDebitsPlexus),
hMoDebitsCollab),
hDebitsLegends),
hDebitsUltra),
hDebitsCapitol),
hDebitsSandiego),
hDebitsTampabay), hDebitsStcloud),
hMoDebitsAltair);
+69
private static <T extends Contract> Class getClazz(T contract) {
return contract instanceof ContractLease ? ContractLease.class :
contract instanceof ContractPlantsSale ? ContractPlantsSale.class :
contract instanceof ContractForestWorks ? ContractForestWorks.class :
contract instanceof ContractPermanent ? ContractPermanent.class :
contract instanceof ContractForestDeclaration ? ContractForestDeclaration.class :
contract instanceof ContractReport ? ContractReport.class : null;
Обожаю такие штуки, такая красивая лесенка...
+69
debug("Continue current `round={}`", next);
/** 3-мя строчками ниже */
debug("Next round `round={}`", current);
+69
package mypackage;
import java.io.*;
public class RimToArab {
public static void main(String [] args){
System.out.println("Enter the Roman numeral:");
String Rim = "";
char[] Rch = {'I','V','X','L','C','D','M'};
int[] Acf = {1,5,10,50,100,500,1000};
int i,j=0,rez=0;
try {
BufferedReader d = new BufferedReader(new InputStreamReader(System.in));
Rim = d.readLine();
} catch (IOException e) {
System.out.println("Input error!");
}
for (int c = Rim.length()-1; c>=0; --c ){
for(i=6;i>=0; --i){
if (Rch[i]==Rim.charAt(c)){
if (j>Acf[i]){
rez=rez-Acf[i];
} else {
rez=rez+Acf[i];
}
j=Acf[i];
}
}
}
if (rez!=0){
System.out.println(rez);
} else {
System.out.println("Wrong format of input!");
}
}
}
говнокод наоборот римские в арабские
+69
"add()\n";
assert((row_indx >= 0 && row_indx <= rows) &&
(col_indx >= 0 && col_indx < cols)
);
if(row_indx == rows)
addRow();
if(init_flag_arr[row_indx][col_indx])
{
std::cout « "in moving\n";
int uninit_i, uninit_j;
bool found = false;
for(int i = row_indx; found == false && i < rows; i++)
for(int j = col_indx; found == false && j < cols; j++)
if(!init_flag_arr[i][j]) // если флаг == false
{
std::cout « "found!\n";
uninit_i = i;
uninit_j = j;
found = true;
}
if(!found)
{
std::cout « "not found!\n";
addRow(); // добовляем новую строку в матрицу (rows++)
uninit_i = rows - 1;
uninit_j = 0;
}
bool exit = false;
for(int i = uninit_i, j = uninit_j; exit == false; i--)
{
for(; ;j--)
{
if(j == col_indx && i == row_indx)
{
exit = true;
break;
}
if(j == 0)
{
matrix[i][j] = matrix[i - 1][cols - 1];
init_flag_arr[i][j] = init_flag_arr[i - 1][cols - 1];
break;
}
matrix[i][j] = matrix[i][j - 1];
init_flag_arr[i][j] = init_flag_arr[i][j - 1];
}
j = cols - 1;
}
}
matrix[row_indx][col_indx] = obj;
init_flag_arr[row_indx][col_indx] = true;
std::cout « "end add()\n";
}
// Для дебага, вывод инициализированных ячеек матрицы
void Matrix::InitTable(std::ostream& os)const // чисто для дебага
{
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < cols; j++)
if(!init_flag_arr[i][j])
os « "false\t";
else
os « "true\t";
os « std::endl;
}
}
// Удаление объекта с матрицы
void Matrix::remove(int row_indx, int col_indx)
{
std::cout « "remove()\n";
assert((row_indx >= 0 && row_indx < rows) &&
(col_indx >= 0 && col_indx < cols)
);
matrix[row_indx][col_indx] = 0;
init_flag_arr[row_indx][col_indx] = false;
std::cout « "end remove()\n";
}
void Matrix::removeRow(int row_indx)
{
assert(row_indx >= 0 && row_indx < rows);
int** new_matrix = new int*[rows - 1];
bool** new_init_flag_arr = new bool*[rows];
for(int i = 0; i < rows - 1; i++)
{
new_matrix[i] = new int[cols];
new_init_flag_arr[i] = new bool[cols];
//for(int j = 0; j < cols; j++)
//{
// new_matrix[i][j] = 0;
// new_init_flag_arr[i][j] = false;
//}/
...
+69
public static boolean isEmpty(CharSequence str) {
if (str == null || str.length() == 0)
return true;
else
return false;
}
Я считаю это странным
Нашёл в android.text.TextUtils
+69
package com.javarush.test.level06.lesson11.bonus02;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/* Нужно добавить в программу новую функциональность
Задача: У каждой кошки есть имя и кошка-мама. Создать класс, который бы описывал данную ситуацию. Создать два объекта: кошку-дочь и кошку-маму. Вывести их на экран.
Новая задача: У каждой кошки есть имя, кошка-папа и кошка-мама. Изменить класс Cat так, чтобы он мог описать данную ситуацию.
Создать 6 объектов: маму, папу, сына, дочь, бабушку(мамина мама) и дедушку(папин папа).
Вывести их всех на экран в порядке: дедушка, бабушка, папа, мама, сын, дочь.
Пример ввода:
дедушка Вася
бабушка Мурка
папа Котофей
мама Василиса
сын Мурчик
дочь Пушинка
Пример вывода:
Cat name is дедушка Вася, no mother, no father
Cat name is бабушка Мурка, no mother, no father
Cat name is папа Котофей, no mother, father is дедушка Вася
Cat name is мама Василиса, mother is бабушка Мурка, no father
Cat name is сын Мурчик, mother is мама Василиса, father is папа Котофей
Cat name is дочь Пушинка, mother is мама Василиса, father is папа Котофей
*/
public class Solution
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String grfatherName = reader.readLine();
Cat catGrfather = new Cat(grfatherName);
String grmotherName = reader.readLine();
Cat catGrmother = new Cat(grmotherName);
String fatherName = reader.readLine();
Cat catFather = new Cat(fatherName, catGrfather, null);
String motherName = reader.readLine();
Cat catMother = new Cat(motherName, null, catGrmother);
String sonName = reader.readLine();
Cat catSon = new Cat(sonName, catFather, catMother);
String daughterName = reader.readLine();
Cat catDaughter = new Cat(daughterName, catFather, catMother);
System.out.println(catGrfather);
System.out.println(catGrmother);
System.out.println(catFather);
System.out.println(catMother);
System.out.println(catSon);
System.out.println(catDaughter);
}
public static class Cat
{
private String name;
private Cat father;
private Cat mother;
Cat(String name)
{
this.name = name;
}
Cat (String name, Cat father, Cat mother){
this.name = name;
this.mother = mother;
this.father = father;
}
@Override
public String toString()
{
if ((mother == null) && (father == null))
return "Cat name is " + name + ", no mother, no father ";
else if (father == null)
return "Cat name is " + name + ", mother is " + mother.name + " , no father";
else if (mother == null)
return "Cat name is " + name + ", no mather " + ", father is " + father.name;
else
return "Cat name is " + name + ", mother is " + mother.name + ", father is " + father.name;
}
}
}
Да лаба, точнее задание. Но меня так умиляет решение задачи :) Просто немного хардкода :)
+69
public void startApp() {
StringItem si = new StringItem("Some label","Some text");
try{
Image img = Image.createImage("/res/path/to/image.gif");
FORM.append(img);
}catch (java.io.IOException ioe){
ioe.printStackTrace();
}
FORM.append(si);
DISPLAY.setCurrent(FORM);
}
Wtf?
http://www.gfs-team.ru/articles/read/107
+69
final double base = 10.0;
final int minCode = (int)Math.pow(base, CODE_LENGTH - 1) - 1;
final int maxCode = (int)Math.pow(base, CODE_LENGTH) - 1;
while (true)
{
final int code = codeGenerator.nextInt();
if ((code > minCode) && (code <= maxCode))
{
return String.valueOf(code);
}
}
Геренация случайного пина с определенным интервалом.