Java

Table of Contents

Introduction

Philosophy

Gettting Started

Basics

Arrays

  • How to sort elements in an array?
    double[] x = {2.3,2.2,1.0,5.7,4.2};
    Arrays.sort(x);
    
  • How to join elements of an array into a string?
    String s = Arrays.toString(x);
    System.out.println(s);
    
  • How to find the index of an element with binary search?
    int[] y = {4,5,1,2,6};
    Arrays.sort( y );
    int idx = Arrays.binarySearch(y, 3);
    System.out.println( idx );
    
  • How to compare two arrays?
    int[] m = {1,2,3}, n = {1,2,3};
    boolean result = Arrays.equals(m, n);
    System.out.println(result);
    

Intermediary

Databases

Options

Advanced

Internationalization

How to load a resource bundle?

public static ResourceBundle getResourceBundle(String key, Locale locale) {    {
    try {
	URL[] urls = {VarStore.RESOURCE_FOLDER.toURI().toURL()};
	ClassLoader loader = new URLClassLoader(urls);
	ResourceBundle rb = ResourceBundle.getBundle(key, locale, loader);
	return rb;            
    } catch (Exception e) {
	throw new RuntimeExcpetion(e)
    }
}

(See stackoverflow.com)

Dependency Injection

Libraries, tools and frameworks

JCommander

jDepend

Visualize package cycles

Jersey

JFreeChart

jQAssistant

build analysis; rules, queries, and tests

Sonar graph

Sonarcube

GitHubImpressum