Here you can find the source of invert(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static byte[] invert(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { /**//from w ww . ja v a 2 s.co m * Invert the provided byte array. * * @param bytes * @return a byte array with all 0s flipped to 1s and 1s flipped to zeroes */ public static byte[] invert(byte[] bytes) { byte[] invertedBytes = new byte[bytes.length]; for (int i = 0; i < bytes.length; i++) { invertedBytes[i] = (byte) (~bytes[i]); } return invertedBytes; } }