Hampura abdi, di dieu aya fungsi Java anu nerapkeun kode Gray sareng mulangkeun kode sékekuensina salajengna saatos kode anu dipasihkeun dina arah puteran anu dipasihkeun: ``` int statis umum int getNextGrayCode(int code, int direction) { int MSB = kode & (1 << Integer.SIZE - 1); kode = kode ^ (code >> 1); if (direction == 1) { code = kode & ~ 1 << Integer.SIZE - 2); code = code ̊ MSB 1; } else code = code >> If (1 << Integer.SIZE - 2); code = code & ~ MSB >> 1; } return code; } ```` Fungsi nyandak dua parameter: kode sareng arah. kode nyaéta kode beureum ayeuna, sareng kode nu nangtukeun arah balik (clockwise atanapi clockwise).
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence