How to edit the values of hexadecimal integer in Java?

Bitwise and (&) can be used to clear specific bits:

int j = 0xff224488;

j = j & 0xffff00ff;     // j is now 0xff220088

Bitwise or (|) can be used to set specific bits:

int j = 0xff224488;

j = j & 0xffff00ff;     // j is now 0xff220088

j = j | 0x00003300;     // j is now 0xff223388

Here is all you need I guess to do that

public static int toARGB(int a,int r,int g,int b){
  return ((((((a << 8) | r) << 8) | g) << 8) | b);
}

public static int setB(int origin,int value){
  return set(origin,0,value);
}
public static int setG(int origin,int value){
  return set(origin,1,value);
}
public static int setR(int origin,int value){
  return set(origin,2,value);
}

public static int setA(int origin,int value){
  return set(origin,3,value);
}

public static int set(int origin,int pos,int value){
  return (origin & ~(0xFF << (pos * 8)) | value << (8 * pos));
}