Here you can find the source of bit_marker_flexint(String attribute, int bit, boolean on)
public static String bit_marker_flexint(String attribute, int bit, boolean on)
//package com.java2s; //License from project: Open Source License public class Main { public static final String FLEXINT_TYPE = "flexint"; public static final int FLEXINT_MAXBITS = 64; public static String bit_marker_flexint(String attribute, int bit, boolean on) { return bit_marker(attribute, FLEXINT_TYPE, FLEXINT_MAXBITS, bit, on); }/*from w w w . j a v a 2s .c o m*/ private static String bit_marker(String attribute, String type, int maxBits, int bit, boolean on) { if (bit >= maxBits) throw new RuntimeException("bit is greater than maxbits"); StringBuilder result = new StringBuilder(attribute.length() + maxBits + type.length() + 2); StringBuilder bitmarks = new StringBuilder(maxBits + 1); result.append(attribute).append('_').append(type).append('_'); for (int i = 0; i < maxBits; i++) { bitmarks.append('x'); } bitmarks.setCharAt(maxBits - bit - 1, on ? '1' : '0'); return result.append(bitmarks).toString(); } }