Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; public class Main { public static byte[] removeBy(int value, byte[] content) { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (content.length > 0) { boolean preisSame = true; // int tailIndex = content.length - 1; for (int i = 0; i < content.length; i++) { if (content[i] != value) { preisSame = false; out.write(content[i]); } else if (content[i] == value && preisSame) { //ignore } else if (i == tailIndex) { } else { out.write(value); preisSame = true; } } } return out.toByteArray(); } }