#rate the readability of my code

1 messages · Page 1 of 1 (latest)

kind belfry
#

sorry if its a little bit too unreadable but heres the code

class completelyunreadable {
    static String[][]dat=new String[16][16];
    public static void main(String[] args) {
        dat[0][0]=String.format("%"+7+"s",Integer.toBinaryString(62)).replace(' ','0');
        dat[0][1]="";
        for(char lXm91zY:dat[0][0].toCharArray()){dat[0][1]+=(lXm91zY=='0')?'1':'0';}
        dat[0][2] = Character.toString((char)(100&63)+41)+Character.toString((char)15<<3|9)+Character.toString((char)36&50)+(char)Integer.parseInt(dat[0][1],2)+Character.toString((char)(83^35)+79-(78|69))+Character.toString((char)118&120);
        System.out.println(dat[0][2]);
    }
}```
slim hemlockBOT
# kind belfry sorry if its a little bit too unreadable but heres the code ```java class comple...

Detected code, here are some useful tools:

Formatted code
class completelyunreadable {
  static String[] [] dat = new String[16] [16] ;
  public static void main(String[] args) {
    dat[0] [0]  = String.format("%" + 7 + "s", Integer.toBinaryString(62)).replace('', '0');
    dat[0] [1]  = "";
    for (char lXm91zY : dat[0] [0] .toCharArray()) {
      dat[0] [1]  += (lXm91zY == '0') ? '1' : '0';
    }
    dat[0] [2]  = Character.toString((char ) (100 & 63) + 41) + Character.toString((char ) 15 << 3 | 9) + Character.toString((char ) 36 & 50) + (char ) Integer.parseInt(dat[0] [1] , 2) + Character.toString((char ) (83 ^ 35) + 79 - (78 | 69)) + Character.toString((char ) 118 & 120);
    System.out.println(dat[0] [2] );
  }
}
#

<@&987246883653156906> please have a look, thanks.

slim hemlockBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

empty cove
#

is it production code or written in an unreadable way on purpose?

kind belfry
#

unreadable on purpose

#

idk just for shits and giggles

#

i was gonna write more but that on its own ended up taking 2 hours

empty cove
#

u might be interested in a "sport" called code-golf

kind belfry
#

ok

empty cove
#

there are some fun ideas for making ur code even more unreadable

#

u can change the integer cache

#

so that for example 2+2 becomes 5, not 4

#

that would be a nice addition to ur math above

kind belfry
#

what

empty cove
#
public class Main {
    public static void main(String[] args) throws Exception {
        Class cache = Integer.class.getDeclaredClasses()[0];
        Field c = cache.getDeclaredField("cache");
        c.setAccessible(true);
        Integer[] array = (Integer[]) c.get(cache);
        array[132] = array[133];

        System.out.printf("%d",2 + 2);
    }
}

this prints 5

kind belfry
#

the fuck

#

hell naw i aint doin that type of stuff

#

considering that i am a math nerd

#

:p

split wren
#

static String[] [] dat = new String[16] [16] ; -> static String [] dat [] = new String[16] [16] ;

kind belfry
#

not much of a difference but sure i suppose

split wren
#

Integer.toBinaryString(62) -> Integer.toString(076, 0x02)

empty cove
#

octal numbers are really mean

#

especially if u let them look like binaries

#

01100100 & 11100101

vagrant pond
vagrant pond
split wren
#

It's worth slipping in a static and instance initialiser just to throw them off too - too few devs have seen them.

#

The rube-goldberg String to char[]?

IntStream.range(0, dat[0][0].length()).mapToObj(i -> i).collect(() -> new char[dat[0][0].length()], (i, a) -> i[a] = dat[0][0].charAt(a), (a, i) -> {})
dusty osprey
spring cipher
#

Yeah but to do that u need to make it unreadable as well

#

You could also replace 16 by bit shifts

#

And you could use bitwise expressions to represent ur standard indices of 0 1 and 2