List of usage examples for java.lang Long toBinaryString
public static String toBinaryString(long i)
From source file:Main.java
public static void main(String[] args) { System.out.println(Long.toBinaryString(10)); }
From source file:Main.java
public static void main(String[] args) { long l = 8;// w w w . ja va2 s . c om System.out.println("Number = " + l); System.out.println("Binary = " + Long.toBinaryString(l)); System.out.println("After reversing = " + Long.reverseBytes(l)); }
From source file:Main.java
public static void main(String[] args) { long l = 100; System.out.println("Number = " + l); System.out.println("Binary = " + Long.toBinaryString(l)); System.out.println("Number of one bits = " + Long.bitCount(l)); }
From source file:Main.java
public static void main(String[] args) { long l = 100; System.out.println("Number = " + l); System.out.println("Binary = " + Long.toBinaryString(l)); System.out.println("Lowest one bit = " + Long.lowestOneBit(l)); }
From source file:Main.java
public static void main(String[] args) { long l = 100; System.out.println("Number = " + l); System.out.println("Binary = " + Long.toBinaryString(l)); System.out.println("Lowest one bit = " + Long.highestOneBit(l)); }
From source file:Main.java
public static void main(String[] args) { long l = 100; System.out.println("Number = " + l); System.out.println("Binary = " + Long.toBinaryString(l)); System.out.println("Lowest one bit = " + Long.lowestOneBit(l)); System.out.print("Number of leading zeros = "); System.out.println(Long.numberOfLeadingZeros(l)); System.out.print("Number of trailing zeros = "); System.out.println(Long.numberOfTrailingZeros(l)); }
From source file:Main.java
/** * 7 => 00000111//from ww w. ja v a 2 s. c o m * * @param src * @return */ public static String getBinaryString(long src) { String binaryString = Long.toBinaryString(src); String temp = ""; for (int i = 0; i < Long.SIZE - binaryString.length(); i++) { temp += "0"; } binaryString = temp + binaryString; return binaryString; }
From source file:edu.msu.cme.rdp.graph.sandbox.BloomFilterInterrogator.java
public static void printStats(BloomFilter filter, PrintStream out) { long n = filter.getUniqueKmers(); long m = (long) Math.pow(2, filter.getHashSizeLog2()); int k = filter.getHashCount(); //(1-e^(-k*((n+.5)/(m-1))))^k double falsePositiveRate = Math.pow((1 - Math.pow(Math.E, -k * ((n + .5) / (m - 1)))), k); out.println("Bloom filter created on: " + filter.getCreatedOn()); out.println("Serializable id: " + BloomFilter.serialVersionUID); out.println();//from www.j a v a 2s . co m out.println("Bloom filter size log 2: " + filter.getHashSizeLog2()); out.println("Bloom filter size (bits) (m): " + m); out.println(); out.println("Number of bitsets: " + filter.getNumBitsets()); out.println("Bitset size (bits): " + filter.getBitsetSize()); out.println("Bitset size log2: " + filter.getBitsetSizeLog2()); out.println(); out.println("Number of hashes (k): " + filter.getHashCount()); out.println("Hash function name: " + filter.getHasherClassName()); out.println(); out.println("Bitset Mask: " + StringUtils.leftPad(Long.toBinaryString(filter.getBitsetMask()), 64, '0')); out.println("Hash mask: " + StringUtils.leftPad(Long.toBinaryString(filter.getHashMask()), 64, '0')); out.println(); out.println("Kmer length: " + filter.getKmerSize()); out.println(); out.println("Total kmers in bloom filter: " + filter.getTotalKmers()); out.println("Total strings inserted: " + filter.getTotalStrings()); out.println("Total unique kmers: " + filter.getUniqueKmers()); out.println("Predicted false positive rate: " + falsePositiveRate); }
From source file:edu.msu.cme.rdp.graph.utils.BloomFilterStats.java
public static void printStats(BloomFilter filter, PrintStream out) { long n = filter.getUniqueKmers(); long m = (long) Math.pow(2, filter.getHashSizeLog2()); int k = filter.getHashCount(); //(1-e^(-k*((n+.5)/(m-1))))^k double falsePositiveRate = Math.pow((1 - Math.pow(Math.E, -k * ((n + .5) / (m - 1)))), k); out.println("Bloom filter created on: " + filter.getCreatedOn()); out.println("Serializable id: " + BloomFilter.serialVersionUID); out.println();//from w ww . jav a 2 s. c om out.println("Bloom filter size log 2: " + filter.getHashSizeLog2()); out.println("Bloom filter size (bits) (m): " + m); out.println(); out.println("Number of bitsets: " + filter.getNumBitsets()); out.println("Bitset size (bits): " + filter.getBitsetSize()); out.println("Bitset size log2: " + filter.getBitsetSizeLog2()); out.println(); out.println("Number of hashes (k): " + filter.getHashCount()); out.println("Hash function name: " + filter.getHasherClassName()); out.println(); out.println("Bitset Mask: " + StringUtils.leftPad(Long.toBinaryString(filter.getBitsetMask()), 64, '0')); out.println("Hash mask: " + StringUtils.leftPad(Long.toBinaryString(filter.getHashMask()), 64, '0')); out.println(); out.println("Kmer length: " + filter.getKmerSize()); out.println(); out.println("Total kmers in bloom filter: " + filter.getTotalKmers()); out.println("Total strings inserted: " + filter.getTotalStrings()); out.println("Total unique kmers: " + filter.getUniqueKmers()); if (filter.getSingltonKmers() > -1) { out.println("Total mercy kmers if set: " + filter.getMercyKmers()); out.println("Total singleton kmers: " + filter.getSingltonKmers()); } out.println("Predicted false positive rate: " + falsePositiveRate); }
From source file:de.uniwue.info2.numerics.prec.DoublePrecisionFloat.java
@Override protected String floatValueToBinaryString(String value) { double d = Double.parseDouble(value); String binary;/*from www . ja v a2 s .com*/ if (d == 0) { binary = StringUtils.repeat("0", 64); } else { binary = Long.toBinaryString(Double.doubleToLongBits(d)); } return binary; }