Java Zero Format ZeroOneStringToBooleanArray(String data)

Here you can find the source of ZeroOneStringToBooleanArray(String data)

Description

Zero One String To Boolean Array

License

Apache License

Declaration

public static Boolean[] ZeroOneStringToBooleanArray(String data) 

Method Source Code

//package com.java2s;
/*//www.  j a  v  a2s .c  o m
 * Copyright 2017 ozkr16.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    public static Boolean[] ZeroOneStringToBooleanArray(String data) {
        char[] zeroOneChars = data.trim().replace(" ", "").toCharArray();
        Boolean[] booleanResult = new Boolean[zeroOneChars.length];
        int i = 0;
        for (char bit : zeroOneChars) {
            booleanResult[i] = (bit == '1');
            ++i;
        }
        return booleanResult;
    }
}

Related

  1. zeroIfNullStrict(Integer i)
  2. zeroInterval(byte[] x, int start, int end)
  3. zeroLowerBits(long bits, int nBits)
  4. zeroMatrix(int M, int N, double mat[][])
  5. zeroObjects()
  6. zeroOrderBessel(float num)
  7. zeroOrMore(String... patterns)
  8. zeroOut(byte[] array)
  9. ZeroPoleFilter(float In[], int In_idx, float ZeroCoef[], float PoleCoef[], int PoleCoef_idx, int lengthInOut, int orderCoef, float Out[], int Out_idx)