I want to define these constants and | them for different operations to generate correct permissions.
Defining them as :
public static final int READ = 4;
public static final int WRITE = 2;
public static final int EXECUTE = 1;
gives me correct result as expected, like READ | WRITE | EXECUTE or WRITE | EXECUTE.
Does defining them as
public static final int READ = 0x4;
public static final int WRITE = 0x2;
public static final int EXECUTE = 0x1;
give me any benefit?
Since they are equivalent in hex or decimal, that only adds in terms of readability for other developers. It's functionally the same.
Although, if you are doing it for readability, octal would be even better given the underlying system:
or even more obvious:
But that might be excessive :)