<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>bitfuture.eth</title>
        <link>https://paragraph.com/@bitfuture</link>
        <description>undefined</description>
        <lastBuildDate>Fri, 01 May 2026 09:04:39 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Java Quick CheatSheet]]></title>
            <link>https://paragraph.com/@bitfuture/java-quick-cheatsheet</link>
            <guid>TcK6FD8zWu4WLsrs44sh</guid>
            <pubDate>Mon, 05 Dec 2022 07:12:12 GMT</pubDate>
            <description><![CDATA[Java Data TypesPrimitive Data Typesbyteshortintlongfloat: ~6-7 decimal digitsdouble: 15 decimal digitschar: surrounded by single quotesbooleanNotes:End the value with an "f" for floats and "d" for doublesNon-Primitive Data TypesString (object): surrounded by double quotesMethodslength(), toUpperCase(), toLowerCase(), indexOf(), concat() or +, see more here.Notes:Non-primitive types can be used to call methods to perform certain operations, while primitive types cannot.A primitive type has alw...]]></description>
            <content:encoded><![CDATA[<h1 id="h-java-data-types" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Data Types</h1><h2 id="h-primitive-data-types" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Primitive Data Types</h2><ul><li><p><code>byte</code></p></li><li><p><code>short</code></p></li><li><p><code>int</code></p></li><li><p><code>long</code></p></li><li><p><code>float</code>: ~6-7 decimal digits</p></li><li><p><code>double</code>: 15 decimal digits</p></li><li><p><code>char</code>: surrounded by single quotes</p></li><li><p><code>boolean</code></p></li></ul><h3 id="h-notes" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Notes:</h3><ol><li><p>End the value with an &quot;f&quot; for floats and &quot;d&quot; for doubles</p></li></ol><h2 id="h-non-primitive-data-types" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Non-Primitive Data Types</h2><ul><li><p><code>String</code> (object): surrounded by double quotes</p></li></ul><h3 id="h-methods" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Methods</h3><p><code>length(), toUpperCase(), toLowerCase(), indexOf(), concat()</code> or <code>+, </code>see more <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.w3schools.com/java/java_ref_string.asp">here</a>.</p><h3 id="h-notes" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Notes:</h3><ol><li><p>Non-primitive types can be used to call methods to perform certain operations, while primitive types cannot.</p></li><li><p>A primitive type has always a value, while non-primitive types can be <code>null</code>.</p></li><li><p>If you add a number and a string, the result will be a string concatenation.</p></li></ol><h1 id="h-java-array" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Array</h1><pre data-type="codeBlock" text="String[] cars = {&quot;Volvo&quot;, &quot;BMW&quot;, &quot;Ford&quot;, &quot;Mazda&quot;};
for (int i = 0; i &lt; cars.length; i++) {
  System.out.println(cars[i]);
}
"><code>String[] cars <span class="hljs-operator">=</span> {<span class="hljs-string">"Volvo"</span>, <span class="hljs-string">"BMW"</span>, <span class="hljs-string">"Ford"</span>, <span class="hljs-string">"Mazda"</span>};
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i <span class="hljs-operator">=</span> <span class="hljs-number">0</span>; i <span class="hljs-operator">&#x3C;</span> cars.<span class="hljs-built_in">length</span>; i<span class="hljs-operator">+</span><span class="hljs-operator">+</span>) {
  System.out.println(cars[i]);
}
</code></pre><p>or,</p><pre data-type="codeBlock" text="int[][] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} };
"><code>int<span class="hljs-section">[]</span><span class="hljs-section">[]</span> <span class="hljs-attr">myNumbers</span> = { {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>}, {<span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>} }<span class="hljs-comment">;</span>
</code></pre><h1 id="h-java-class" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Class</h1><h2 id="h-math" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Math</h2><p><code>min(), max(), abs(), random()</code> see more <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.w3schools.com/java/java_ref_math.asp">here</a>.</p><h2 id="h-arraylist" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">ArrayList</h2><p>The <code>ArrayList</code> class is a resizable array.</p><h3 id="h-methods" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Methods</h3><p><code>add(), get(), set(), remove(), clear(), size()</code> Use <code>Collections</code> for sorting lists alphabetically or numerically.</p><pre data-type="codeBlock" text="import java.util.ArrayList;
import java.util.Collections;  // Import the Collections class

public class Main {
  public static void main(String[] args) {
    ArrayList&lt;Integer&gt; myNumbers = new ArrayList&lt;Integer&gt;();
    myNumbers.add(33);
    myNumbers.add(15);
    myNumbers.add(20);
    myNumbers.add(34);
    myNumbers.add(8);
    myNumbers.add(12);

    Collections.sort(myNumbers);  // Sort myNumbers

    for (int i : myNumbers) {
      System.out.println(i);
    }
  }
}
"><code><span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">ArrayList</span>;
<span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">Collections</span>;  <span class="hljs-comment">// Import the Collections class</span>

<span class="hljs-keyword">public</span> class Main {
  <span class="hljs-keyword">public</span> static void main(String[] args) {
    ArrayList<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span> myNumbers <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> ArrayList<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span>();
    myNumbers.add(<span class="hljs-number">33</span>);
    myNumbers.add(<span class="hljs-number">15</span>);
    myNumbers.add(<span class="hljs-number">20</span>);
    myNumbers.add(<span class="hljs-number">34</span>);
    myNumbers.add(<span class="hljs-number">8</span>);
    myNumbers.add(<span class="hljs-number">12</span>);

    Collections.sort(myNumbers);  <span class="hljs-comment">// Sort myNumbers</span>

    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i : myNumbers) {
      System.out.println(i);
    }
  }
}
</code></pre><h3 id="h-notes" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Notes</h3><ol><li><p>Elements in an ArrayList are actually objects. In the examples above, we created elements (objects) of type &quot;String&quot;. Remember that a String in Java is an object (not a primitive type). To use other types, such as <code>int</code>, you must specify an equivalent wrapper class: <code>Integer</code>. For other primitive types, use: <code>Boolean</code> for <code>boolean</code>, <code>Character</code> for <code>char</code>, <code>Double</code> for <code>double</code>, <code>Float</code> for <code>float</code>, etc.</p></li></ol><h2 id="h-linkedlist" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">LinkedList</h2><p>The <code>LinkedList</code> class has all of the same methods as the <code>ArrayList</code> class because they both implement the <code>List</code> interface.</p><h3 id="h-difference" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Difference</h3><ul><li><p>The <code>ArrayList</code> class has a regular array inside it. When an element is added, it is placed into the array. If the array is not big enough, a new, larger array is created to replace the old one and the old one is removed.</p></li><li><p>The <code>LinkedList</code> stores its items in &quot;containers.&quot; The list has a link to the first container and each container has a link to the next container in the list. To add an element to the list, the element is placed into a new container and that container is linked to one of the other containers in the list.</p></li><li><p>Use an ArrayList for storing and accessing data, and LinkedList to manipulate data.</p></li></ul><h3 id="h-methods" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Methods</h3><p><code>addFirst(), addLast(), removeFirst(), removeLast(), getFirst(), getLast()</code></p><h2 id="h-hashmap" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">HashMap</h2><p>A <code>HashMap</code> however, store items in &quot;key/value&quot; pairs, and you can access them by an index of another type.</p><h3 id="h-methods" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Methods</h3><p><code>put(), get(), remove(), clear(), size(), keySet(), values()</code></p><pre data-type="codeBlock" text="// Import the HashMap class
import java.util.HashMap;

public class Main {
  public static void main(String[] args) {
    // Create a HashMap object called capitalCities
    HashMap&lt;String, String&gt; capitalCities = new HashMap&lt;String, String&gt;();

    // Add keys and values (Country, City)
    capitalCities.put(&quot;England&quot;, &quot;London&quot;);
    capitalCities.put(&quot;Germany&quot;, &quot;Berlin&quot;);
    capitalCities.get(&quot;England&quot;);
    capitalCities.remove(&quot;England&quot;);
    for (String i : capitalCities.keySet()) {
      System.out.println(i);
    }
  }
}
"><code><span class="hljs-comment">// Import the HashMap class</span>
<span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">HashMap</span>;

<span class="hljs-keyword">public</span> class Main {
  <span class="hljs-keyword">public</span> static void main(String[] args) {
    <span class="hljs-comment">// Create a HashMap object called capitalCities</span>
    HashMap<span class="hljs-operator">&#x3C;</span>String, String<span class="hljs-operator">></span> capitalCities <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> HashMap<span class="hljs-operator">&#x3C;</span>String, String<span class="hljs-operator">></span>();

    <span class="hljs-comment">// Add keys and values (Country, City)</span>
    capitalCities.put(<span class="hljs-string">"England"</span>, <span class="hljs-string">"London"</span>);
    capitalCities.put(<span class="hljs-string">"Germany"</span>, <span class="hljs-string">"Berlin"</span>);
    capitalCities.get(<span class="hljs-string">"England"</span>);
    capitalCities.remove(<span class="hljs-string">"England"</span>);
    <span class="hljs-keyword">for</span> (String i : capitalCities.keySet()) {
      System.out.println(i);
    }
  }
}
</code></pre><h2 id="h-hashset" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">HashSet</h2><p>A <code>HashSet</code> is a collection of items where every item is unique.</p><h3 id="h-methods" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Methods</h3><p><code>add(), contains(), remove(), clear(), size()</code></p><pre data-type="codeBlock" text="// Import the HashSet class
import java.util.HashSet;

public class Main {
  public static void main(String[] args) {
    HashSet&lt;String&gt; cars = new HashSet&lt;String&gt;();
    cars.add(&quot;Volvo&quot;);
    cars.add(&quot;BMW&quot;);
    cars.add(&quot;Ford&quot;);
    for (String i : cars) {
      System.out.println(i);
    }
  }
}
"><code><span class="hljs-comment">// Import the HashSet class</span>
<span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">HashSet</span>;

<span class="hljs-keyword">public</span> class Main {
  <span class="hljs-keyword">public</span> static void main(String[] args) {
    HashSet<span class="hljs-operator">&#x3C;</span>String<span class="hljs-operator">></span> cars <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> HashSet<span class="hljs-operator">&#x3C;</span>String<span class="hljs-operator">></span>();
    cars.add(<span class="hljs-string">"Volvo"</span>);
    cars.add(<span class="hljs-string">"BMW"</span>);
    cars.add(<span class="hljs-string">"Ford"</span>);
    <span class="hljs-keyword">for</span> (String i : cars) {
      System.out.println(i);
    }
  }
}
</code></pre><h2 id="h-iterator" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Iterator</h2><p>An <code>Iterator</code> is an object that can be used to loop through collections, like <code>ArrayList</code> and <code>HashSet</code>.</p><h3 id="h-methods" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Methods</h3><p><code>hasNext(), next(), remove()</code></p><pre data-type="codeBlock" text="import java.util.ArrayList;
import java.util.Iterator;

public class Main {
  public static void main(String[] args) {
    ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;();
    numbers.add(12);
    numbers.add(8);
    numbers.add(2);
    numbers.add(23);
    Iterator&lt;Integer&gt; it = numbers.iterator();
    while(it.hasNext()) {
      Integer i = it.next();
      if(i &lt; 10) {
        it.remove();
      }
    }
    System.out.println(numbers);
  }
}
"><code><span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">ArrayList</span>;
<span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">Iterator</span>;

<span class="hljs-keyword">public</span> class Main {
  <span class="hljs-keyword">public</span> static void main(String[] args) {
    ArrayList<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span> numbers <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> ArrayList<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span>();
    numbers.add(<span class="hljs-number">12</span>);
    numbers.add(<span class="hljs-number">8</span>);
    numbers.add(<span class="hljs-number">2</span>);
    numbers.add(<span class="hljs-number">23</span>);
    Iterator<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span> it <span class="hljs-operator">=</span> numbers.iterator();
    <span class="hljs-keyword">while</span>(it.hasNext()) {
      Integer i <span class="hljs-operator">=</span> it.next();
      <span class="hljs-keyword">if</span>(i <span class="hljs-operator">&#x3C;</span> <span class="hljs-number">10</span>) {
        it.remove();
      }
    }
    System.out.println(numbers);
  }
}
</code></pre><h2 id="h-enums" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Enums</h2><p>An <code>enum</code> is a special class, cannot be used to create objects.</p><pre data-type="codeBlock" text="enum Level {
  LOW,
  MEDIUM,
  HIGH
}
Level myVar = Level.MEDIUM;

for (Level myVar : Level.values()) {
  System.out.println(myVar);
}
"><code><span class="hljs-keyword">enum</span> <span class="hljs-title">Level</span> {
  LOW,
  MEDIUM,
  HIGH
}
Level myVar <span class="hljs-operator">=</span> Level.MEDIUM;

<span class="hljs-keyword">for</span> (Level myVar : Level.values()) {
  System.out.println(myVar);
}
</code></pre><h2 id="h-class-inheritance" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Class Inheritance</h2><ol><li><p>To inherit from a class, use the <code>extends</code> keyword.</p></li><li><p>Java does not support &quot;multiple inheritance&quot; (a class can only inherit from one superclass). However, it can be achieved with interfaces, because the class can implement multiple interfaces. Note: To implement multiple interfaces, separate them with a comma.</p></li></ol><pre data-type="codeBlock" text="interface FirstInterface {
  public void myMethod(); // interface method
}

interface SecondInterface {
  public void myOtherMethod(); // interface method
}

class DemoClass implements FirstInterface, SecondInterface {
  public void myMethod() {
    System.out.println(&quot;Some text..&quot;);
  }
  public void myOtherMethod() {
    System.out.println(&quot;Some other text...&quot;);
  }
}
"><code><span class="hljs-keyword">interface</span> <span class="hljs-title">FirstInterface</span> {
  <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">myMethod</span>()</span>; <span class="hljs-comment">// interface method</span>
}

<span class="hljs-keyword">interface</span> <span class="hljs-title">SecondInterface</span> {
  <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">myOtherMethod</span>()</span>; <span class="hljs-comment">// interface method</span>
}

<span class="hljs-keyword">class</span> <span class="hljs-title">DemoClass</span> <span class="hljs-title">implements</span> <span class="hljs-title">FirstInterface</span>, <span class="hljs-title">SecondInterface</span> {
  <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">myMethod</span>()</span> {
    System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"Some text.."</span>);
  }
  <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">myOtherMethod</span>()</span> {
    System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"Some other text..."</span>);
  }
}
</code></pre><h1 id="h-java-if-else" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java If ... Else</h1><h2 id="h-syntax" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Syntax:</h2><pre data-type="codeBlock" text="if (condition1) {
  // block of code to be executed if condition1 is true
} else if (condition2) {
  // block of code to be executed if the condition1 is false and condition2 is true
} else {
  // block of code to be executed if the condition1 is false and condition2 is false
}
"><code><span class="hljs-keyword">if</span> (condition1) {
  // block <span class="hljs-keyword">of</span> code <span class="hljs-keyword">to</span> be executed <span class="hljs-keyword">if</span> condition1 <span class="hljs-built_in">is</span> <span class="hljs-literal">true</span>
} <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (condition2) {
  // block <span class="hljs-keyword">of</span> code <span class="hljs-keyword">to</span> be executed <span class="hljs-keyword">if</span> the condition1 <span class="hljs-built_in">is</span> <span class="hljs-literal">false</span> <span class="hljs-built_in">and</span> condition2 <span class="hljs-built_in">is</span> <span class="hljs-literal">true</span>
} <span class="hljs-keyword">else</span> {
  // block <span class="hljs-keyword">of</span> code <span class="hljs-keyword">to</span> be executed <span class="hljs-keyword">if</span> the condition1 <span class="hljs-built_in">is</span> <span class="hljs-literal">false</span> <span class="hljs-built_in">and</span> condition2 <span class="hljs-built_in">is</span> <span class="hljs-literal">false</span>
}
</code></pre><h1 id="h-java-switch" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Switch</h1><h2 id="h-syntax" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Syntax:</h2><pre data-type="codeBlock" text="int day = 4;
switch (day) {
  case 6:
    System.out.println(&quot;Today is Saturday&quot;);
    break;
  case 7:
    System.out.println(&quot;Today is Sunday&quot;);
    break;
  default:
    System.out.println(&quot;Looking forward to the Weekend&quot;);
}
// Outputs &quot;Looking forward to the Weekend&quot;
"><code><span class="hljs-built_in">int</span> day = <span class="hljs-number">4</span>;
<span class="hljs-keyword">switch</span> (day) {
  <span class="hljs-keyword">case</span> <span class="hljs-number">6</span>:
    System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"Today is Saturday"</span>);
    <span class="hljs-keyword">break</span>;
  <span class="hljs-keyword">case</span> <span class="hljs-number">7</span>:
    System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"Today is Sunday"</span>);
    <span class="hljs-keyword">break</span>;
  <span class="hljs-literal">default</span>:
    System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"Looking forward to the Weekend"</span>);
}
<span class="hljs-comment">// Outputs "Looking forward to the Weekend"</span>
</code></pre><h1 id="h-java-for-each-loop" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java For Each Loop</h1><h2 id="h-used-exclusively-to-loop-through-elements-in-an-array" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Used exclusively to loop through elements in an array</h2><h2 id="h-syntax" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Syntax:</h2><pre data-type="codeBlock" text="String[] cars = {&quot;Volvo&quot;, &quot;BMW&quot;, &quot;Ford&quot;, &quot;Mazda&quot;};
for (String i : cars) {
  System.out.println(i);
}
"><code>String<span class="hljs-section">[]</span> <span class="hljs-attr">cars</span> = {<span class="hljs-string">"Volvo"</span>, <span class="hljs-string">"BMW"</span>, <span class="hljs-string">"Ford"</span>, <span class="hljs-string">"Mazda"</span>}<span class="hljs-comment">;</span>
for (String i : cars) {
  System.out.println(i)<span class="hljs-comment">;</span>
}
</code></pre><h1 id="h-java-lambda-expressions" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Lambda Expressions</h1><p>A lambda expression is a short block of code which takes in parameters and returns a value. Lambda expressions are similar to methods, but they do not need a name and they can be implemented right in the body of a method.</p><h2 id="h-syntax" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Syntax</h2><p><code>(parameter1, parameter2) -&gt; { code block }</code></p><pre data-type="codeBlock" text="import java.util.ArrayList;

public class Main {
  public static void main(String[] args) {
    ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;();
    numbers.add(5);
    numbers.add(9);
    numbers.add(8);
    numbers.add(1);
    numbers.forEach( (n) -&gt; { System.out.println(n); } );
  }
}
"><code><span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">ArrayList</span>;

<span class="hljs-keyword">public</span> class Main {
  <span class="hljs-keyword">public</span> static void main(String[] args) {
    ArrayList<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span> numbers <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> ArrayList<span class="hljs-operator">&#x3C;</span>Integer<span class="hljs-operator">></span>();
    numbers.add(<span class="hljs-number">5</span>);
    numbers.add(<span class="hljs-number">9</span>);
    numbers.add(<span class="hljs-number">8</span>);
    numbers.add(<span class="hljs-number">1</span>);
    numbers.forEach( (n) <span class="hljs-operator">-</span><span class="hljs-operator">></span> { System.out.println(n); } );
  }
}
</code></pre><h1 id="h-java-regular-expressions" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Regular Expressions</h1><p>Use <code>java.util.regex</code> package to work with regular expressions. The package includes the following classes:</p><ul><li><p><code>Pattern</code> Class - Defines a pattern (to be used in a search)</p></li><li><p><code>Matcher</code> Class - Used to search for the pattern</p></li><li><p><code>PatternSyntaxException</code> Class - Indicates syntax error in a regular expression pattern</p></li></ul><pre data-type="codeBlock" text="import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
  public static void main(String[] args) {
    Pattern pattern = Pattern.compile(&quot;w3schools&quot;, Pattern.CASE_INSENSITIVE);
    Matcher matcher = pattern.matcher(&quot;Visit W3Schools!&quot;);
    boolean matchFound = matcher.find();
    if(matchFound) {
      System.out.println(&quot;Match found&quot;);
    } else {
      System.out.println(&quot;Match not found&quot;);
    }
  }
}
"><code><span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">regex</span>.<span class="hljs-title">Matcher</span>;
<span class="hljs-keyword">import</span> <span class="hljs-title">java</span>.<span class="hljs-title">util</span>.<span class="hljs-title">regex</span>.<span class="hljs-title">Pattern</span>;

<span class="hljs-keyword">public</span> class Main {
  <span class="hljs-keyword">public</span> static void main(String[] args) {
    Pattern pattern <span class="hljs-operator">=</span> Pattern.compile(<span class="hljs-string">"w3schools"</span>, Pattern.CASE_INSENSITIVE);
    Matcher matcher <span class="hljs-operator">=</span> pattern.matcher(<span class="hljs-string">"Visit W3Schools!"</span>);
    boolean matchFound <span class="hljs-operator">=</span> matcher.find();
    <span class="hljs-keyword">if</span>(matchFound) {
      System.out.println(<span class="hljs-string">"Match found"</span>);
    } <span class="hljs-keyword">else</span> {
      System.out.println(<span class="hljs-string">"Match not found"</span>);
    }
  }
}
</code></pre><h1 id="h-java-exception" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Exception</h1><p>Use <code>try, catch, finally</code>:</p><pre data-type="codeBlock" text="public class Main {
  public static void main(String[] args) {
    try {
      int[] myNumbers = {1, 2, 3};
      System.out.println(myNumbers[10]);
    } catch (Exception e) {
      System.out.println(&quot;Something went wrong.&quot;);
    } finally {
      System.out.println(&quot;The &apos;try catch&apos; is finished.&quot;);
    }
  }
}
"><code><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title">Main</span> {
  <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span>(<span class="hljs-params">String[] args</span>)</span> {
    <span class="hljs-keyword">try</span> {
      <span class="hljs-built_in">int</span>[] myNumbers = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>};
      System.<span class="hljs-keyword">out</span>.println(myNumbers[<span class="hljs-number">10</span>]);
    } <span class="hljs-keyword">catch</span> (Exception e) {
      System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"Something went wrong."</span>);
    } <span class="hljs-keyword">finally</span> {
      System.<span class="hljs-keyword">out</span>.println(<span class="hljs-string">"The 'try catch' is finished."</span>);
    }
  }
}
</code></pre><h1 id="h-java-packages" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Java Packages</h1><p>A package in Java is used to group related classes.</p><h2 id="h-import-a-class" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Import a class</h2><p><code>import java.util.Scanner;</code></p><h2 id="h-import-a-whole-package" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Import a whole package</h2><p><code>import java.util.*;</code></p>]]></content:encoded>
            <author>bitfuture@newsletter.paragraph.com (bitfuture.eth)</author>
        </item>
        <item>
            <title><![CDATA[setup群控在币圈撸毛交互]]></title>
            <link>https://paragraph.com/@bitfuture/setup</link>
            <guid>YlBWAR8ku4SGHecYturI</guid>
            <pubDate>Sat, 29 Oct 2022 05:37:47 GMT</pubDate>
            <description><![CDATA[序言设置群控，就是在本地电脑上同时打开多个浏览器窗口，每个窗口模拟一个独立的用户，窗口之间保持独立，没有关联，包括IP，cookie，浏览痕迹等。并且可以通过控制一个主控窗口同时操控其他的被控窗口，同时进行多个窗口的操作。进行撸毛，还需要每个浏览器窗口都有email，twitter，discord 和metamask等必备件。 以下分别进行介绍：设置群控如上所述，我们需要批量的IP，能够同时打开多个窗口并且彼此独立的浏览器，以及群控软件。IP池当然需要使用海外IP，并且尽量选择监管少的国家，新加坡、澳洲、欧洲（俄罗斯除外）是相对来说比较宽松的。北美其实也可以，不过有风险某些项目会不支持。可以选择搭建或购买一个IP群服务器，也可以直接购买批量IP。各有很多选择，我在 proxy6.net上买了50个，并且支持加密货币支付。并且尽量选择独立IP。你会得到卡密，类似 [IP]:[port]:[user]:[pswd]，之后使用。 https://proxy6.net/en/?r=454388指纹浏览器需要使用指纹浏览器实现同时打开多个窗口，这里也有很多选择，比特浏览器为免费，并且最近刚...]]></description>
            <content:encoded><![CDATA[<h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">序言</h2><ol><li><p>设置群控，就是在本地电脑上同时打开多个浏览器窗口，每个窗口模拟一个独立的用户，窗口之间保持独立，没有关联，包括IP，cookie，浏览痕迹等。并且可以通过控制一个主控窗口同时操控其他的被控窗口，同时进行多个窗口的操作。</p></li><li><p>进行撸毛，还需要每个浏览器窗口都有email，twitter，discord 和metamask等必备件。</p><p>以下分别进行介绍：</p></li></ol><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">设置群控</h2><p>如上所述，我们需要批量的IP，能够同时打开多个窗口并且彼此独立的浏览器，以及群控软件。</p><h3 id="h-ip" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">IP池</h3><p>当然需要使用海外IP，并且尽量选择监管少的国家，新加坡、澳洲、欧洲（俄罗斯除外）是相对来说比较宽松的。北美其实也可以，不过有风险某些项目会不支持。可以选择搭建或购买一个IP群服务器，也可以直接购买批量IP。各有很多选择，我在 proxy6.net上买了50个，并且支持加密货币支付。并且尽量选择独立IP。你会得到卡密，类似 [IP]:[port]:[user]:[pswd]，之后使用。</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://proxy6.net/en/?r=454388">https://proxy6.net/en/?r=454388</a></p><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">指纹浏览器</h3><p>需要使用指纹浏览器实现同时打开多个窗口，这里也有很多选择，<em>比特浏览器</em>为免费，并且最近刚刚集成了群控软件；<em>adspower</em>为付费，需要另外购买群控软件。我都试过，感觉都不完美，不同步的情况时有发生。相比来说，adspower稍微好一点点。。购买好后，试着批量创建窗口，并且把上一步的IP分配给这些窗口，一对一。此时你就拥有了批量的独立窗口。</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://adspower.saaslink.net/MJKBeGQDORS6sZj">https://adspower.saaslink.net/MJKBeGQDORS6sZj</a></p><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">群控器</h3><p>没有群控器，你就需要手动一个一个操作你刚刚批量创建的窗口，无疑非常费时间。可以去taobao搜索<em>麒麟群控器</em>选择购买。注意，只支持windows电脑，Mac版暂无软件。有了群控器，你就可以批量操作，比如批量排列窗口，打开窗口，浏览网页，鼠标点击、键盘输入等等。你需要首先选择主控窗口，软件就会自动识别你批量打开的其他窗口，并且设置为被控窗口。注意对于像metamask弹出的这种窗口，你需要重新把弹出的窗口选择为主控窗口，你才可以批量操作metamask的弹窗。因为弹出的窗口和浏览器窗口为不同的句柄窗口。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">批量撸毛必备件</h2><p>接下来就是准备撸毛用的一些软件，必不可少的就是gmail，twitter（直接用gmail账户登陆）、discord和metamask。 metamask是最容易创建的，只需要去指纹浏览器的应用中心设置安装chrome store的metamask插件，就可以自动的为你创建的每一个窗口安装插件，然后每个选择创建新钱包、地址，注意保存seed phrase。不要在这些地址之间频繁/批量转账，使用CEX直接向每个地址转账。</p><h3 id="h-gmail" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Gmail</h3><p>首先可以选择批量购买gmail。你也可以选择自己一个一个创建，不过除了需要recovery email还有手机验证。建议你先自己创建几个email账户作为recovery email使用，这些email要拥有绝对控制权，包括密保邮箱和手机号等。大概一个recovery email可以被多个email当作密保邮箱（至少十个应该没问题）。手机验证的话，一般一个手机号不能短时间注册多个email，这时需要使用接码平台。选择也很多，我使用 5sim.net，也支持加密货币支付。注意你需要去尝试不同的国家和operator，并不能保证每个号都可以接到码，没收到码的可以退款。自己创建的使用要在指纹浏览器中进行，每个窗口分别进行，保证相对独立；</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://5sim.net/">https://5sim.net/</a></p><p>如果选择购买邮箱，可以网上搜索，很多选择，注意先购买一个试试。有的号不好的话一登陆就会封。我使用0x90000.com，可以尽量选择你购买IP地址国家的google号，并且选择那些已经手机验证过的、有密保邮箱的。登陆的时候，一般都需要进行验证，可以选择输入密保邮箱地址进行验证，登陆后及时修改密码和你的密保邮箱。</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.0x90000.com/">https://www.0x90000.com/</a></p><h3 id="h-twitter" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Twitter</h3><p>直接可以使用google账户创建登陆。坏处是是新号，极容易被封控进行人机验证。一般创建好后，用一会就回要求人机验证。注意刚开始尽量每个窗口都交互一下，包括关注、转发、点赞和发推，并且分别操作。等第二天登陆的时候我的账户又被要求验证，并且还需要手机验证，这时候就需要再次用到接码平台。通过后在进行交互。一般通过这一步以后就会好很多，不会再被封控，但还是要平时多多养号。</p><h3 id="h-discord" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Discord</h3><p>不知道为什么，我无法接到discord发送的手机验证码，所以无奈我选择批量购买discord账户。当时我选择的是在<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://bffkd.com/links/7E279C1B">https://bffkd.com/links/7E279C1B</a>上购买的，注意你需要使用国内IP才能打开这个网址。购买后你会得倒账户密码和一个token。如果你选择账户密码登陆，大概率会被要求验证手机号，所以推荐token登陆。登陆方法为，在 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://discord.com/login">discord.com/login</a> 页面，代开后台，或者按F12，点到console页面，复制下面代码，注意替换成你自己的token，然后回车。等几秒后，如果正常你就会登进去。如果还是卡在登陆界面，大概率账号有问题，被ban了。</p><pre data-type="codeBlock" text="function login(token) { setInterval(() =&gt; { document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = `&quot;${token}&quot;` }, 50); setTimeout(() =&gt; { location.reload(); }, 2500); } login(“你的token”);
"><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">login</span>(<span class="hljs-params">token</span>) </span>{ setInterval(() <span class="hljs-operator">=</span><span class="hljs-operator">></span> { document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token <span class="hljs-operator">=</span> `<span class="hljs-string">"${token}"</span>` }, <span class="hljs-number">50</span>); setTimeout(() <span class="hljs-operator">=</span><span class="hljs-operator">></span> { location.reload(); }, <span class="hljs-number">2500</span>); } login(“你的token”);
</code></pre><p>注意登陆进去后不要删除密保手机，保持现状正常交互即可。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">最后</h2><p>刚开始多账号撸毛最麻烦的其实是养号，特别是twitter和discord，要多多进行交互并且保持各个账号独立。另外注意IP和你的账号要对应起来，以后不要随便带动，否则新IP登陆容易风控。祝撸毛顺利！</p>]]></content:encoded>
            <author>bitfuture@newsletter.paragraph.com (bitfuture.eth)</author>
        </item>
        <item>
            <title><![CDATA[Hello World]]></title>
            <link>https://paragraph.com/@bitfuture/hello-world</link>
            <guid>dQ55HaIuoYRSgVb7xjWJ</guid>
            <pubDate>Sat, 07 May 2022 21:59:35 GMT</pubDate>
            <description><![CDATA[My first post on Mirror today!]]></description>
            <content:encoded><![CDATA[<p>My first post on Mirror today!</p>]]></content:encoded>
            <author>bitfuture@newsletter.paragraph.com (bitfuture.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/4f6353e0b4b3f0f80738eec110093184ac3c7e1d6e0bbed08e9f9ae19f97f015.png" length="0" type="image/png"/>
        </item>
    </channel>
</rss>