Android Byte Array Cut deleteSpaceLatin(byte[] b)

Here you can find the source of deleteSpaceLatin(byte[] b)

Description

delete Space Latin

Declaration

public static void deleteSpaceLatin(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {

    public static void deleteSpaceLatin(byte[] b) {
        int count = 0;
        int len = b.length;
        for (int i = 0; i < len; i++) {
            int ch = b[i] & 0xff;
            if (ch == '\0') {
                count = count + len - i;
                break;
            } else if (ch == 0x20) {
                count++;/*from   ww  w.  ja  va2s  .c om*/
            } else {
                b[i - count] = (byte) ch;
            }
        }
        if (count > 0) {
            for (int i = len - count; i < len; i++) {
                b[i] = '\0';
            }
        }
    }
}

Related

  1. cutBytes(byte[] bytes, int pos, int length)
  2. deleteSpace(byte[] b)
  3. deleteMark(byte[] b)
  4. remove(byte[] data, int place)