Skip to content

Instantly share code, notes, and snippets.

Bob Lutz rjlutz

Block or report user

Report or block rjlutz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rjlutz
rjlutz / BubbleSort.java
Last active Nov 10, 2017
Sorting and Searching (Chapter 23) -- examples from Liang Intro to Java Comprehensive 10e
View BubbleSort.java
public class BubbleSort {
/** Bubble sort method */
public static void bubbleSort(int[] list) {
boolean needNextPass = true;
for (int k = 1; k < list.length && needNextPass; k++) {
// Array may be sorted and next pass not needed
needNextPass = false;
for (int i = 0; i < list.length - k; i++) {
if (list[i] > list[i + 1]) {
@rjlutz
rjlutz / 1 notes
Last active Apr 1, 2018
Bike and Barge notes and text bits
View 1 notes
add drawables
add to strings (can use translations or copy/paste)
create a new TableLayout underlayouts called photos.xml
add rows (can be found below)
create a new LinearLayout underlayouts called tours.xml
add stuff (can be found below)
@rjlutz
rjlutz / Circle.java
Last active Nov 2, 2017
Lists, Stacks, Queues and Priority Queues (Chapter 20) -- examples from Liang Intro to Java Comprehensive 10e
View Circle.java
public class Circle extends GeometricObject {
private double radius;
public Circle() {
}
public Circle(double radius) {
this.radius = radius;
}
@rjlutz
rjlutz / AnyWildCardDemo.java
Created Oct 19, 2017
Java Generics (Chapter 19) -- examples from Liang Intro to Java Comprehensive 10e
View AnyWildCardDemo.java
public class AnyWildCardDemo {
public static void main(String[] args ) {
GenericStack<Integer> intStack = new GenericStack<Integer>();
intStack.push(1); // 1 is autoboxed into new Integer(1)
intStack.push(2);
intStack.push(-2);
print(intStack);
}
@rjlutz
rjlutz / ComputeFactorial.java
Created Oct 12, 2017
Abstract Classes and Interfaces (Chapter 18) -- examples from Liang Intro to Java Comprehensive 10e
View ComputeFactorial.java
import java.util.Scanner;
public class ComputeFactorial {
/** Main method */
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
System.out.print("Enter a non-negative integer: ");
int n = input.nextInt();
@rjlutz
rjlutz / PixabayResult.java
Created Oct 10, 2017
Pixabay starter code
View PixabayResult.java
package edu.ggc.lutz.pixabayretrofit;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
View gist:4e2a84bf3000e5364dd4cb022750623e
capture json from curl or postman, like
{
"base": "USD",
"date": "2017-10-10",
"rates": {
"CAD": 1.2499,
...
...
}
}
@rjlutz
rjlutz / Circle.java
Last active Sep 27, 2017
Abstract Classes and Interfaces (Chapter 13) -- examples from Liang Intro to Java Comprehensive 10e
View Circle.java
public class Circle extends GeometricObject {
private double radius;
public Circle() {
}
public Circle(double radius) {
this.radius = radius;
}
@rjlutz
rjlutz / CircleWithException.java
Last active Nov 21, 2018
Exceptions and File I/O (Chapter 12) -- examples from Liang Intro to Java Comprehensive 10e
View CircleWithException.java
public class CircleWithException {
/** The radius of the circle */
private double radius;
/** The number of the objects created */
private static int numberOfObjects = 0;
/** Construct a circle with radius 1 */
public CircleWithException() {
this(1.0);
@rjlutz
rjlutz / FIleOutputYahooStockReport.java
Last active Sep 21, 2017
File and Web IO Examples
View FIleOutputYahooStockReport.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class FIleOutputYahooStockReport {
public static void main(String[] args) {
System.out.println("Starting ...");
You can’t perform that action at this time.