Skip to content

Instantly share code, notes, and snippets.

@czxttkl
czxttkl / test
Created May 14, 2013 14:37
a javacv test snippethow to see total line of a git project
@Override
public void actionPerformed(ActionEvent arg0 @Override
public void actionPerformed(ActionEvent arg0
public class HomeWork1b {
private static <T> void findFirstElement(LinkedList<T> linkA,
LinkedList<T> linkB) {
int offsetA = 0;
int offsetB = 0;
if (linkB.size() > linkA.size())
offsetB = linkB.size() - linkA.size();
@czxttkl
czxttkl / homework 1b
Created August 31, 2013 03:36
Two linked lists (simple link, not double link) heads are given: headA, and headB; it is also given that the two lists intersect, thus after the intersection they have the same elements to the end. Find the first common element (without modifying the lists elements or using additional datastructures)
package io.github.czxttkl.homework;
import java.util.LinkedList;
public class HomeWork1b {
private static <T> void findFirstElement(LinkedList<T> linkA,
LinkedList<T> linkB) {
int offsetA = 0;
@czxttkl
czxttkl / gist:6398741
Created August 31, 2013 14:56
Two linked lists (simple link, not double link) heads are given: headA, and headB; it is also given that the two lists intersect, thus after the intersection they have the same elements to the end. Find the first common element (without modifying the lists elements or using additional datastructures)
package io.github.czxttkl.homework;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class HomeWork1b {
private static <T> void findFirstElement(LinkedList<T> linkA,
LinkedList<T> linkB) {
@czxttkl
czxttkl / gist:6401314
Created August 31, 2013 23:30
Two linked lists (simple link, not double link) heads are given: headA, and headB; it is also given that the two lists intersect, thus after the intersection they have the same elements to the end. Find the first common element (without modifying the lists elements or using additional datastructures)
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class HomeWork1b {
private static <T> void findFirstSharedElement(LinkedList<T> linkA,
LinkedList<T> linkB) {
int offsetA = 0;
public class TryJoin {
public static void main(String... arg) throws InterruptedException {
Thread a = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
public void setCurrentMode(int currentMode) {
this.currentMode = currentMode;
switch(mode) {
case MODE_MAIN_MENU:
OpenGLBugManager.generateMainMenuBug();
break;
case MODE_TUTORIAL_1:
public void setCurrentMode(int currentMode) {
this.currentMode = currentMode;
switch(mode) {
case MODE_MAIN_MENU:
OpenGLBugManager.generateMainMenuBug();
break;
case MODE_TUTORIAL_1:
/**
* Return if the point is in the floor's contour +1: inside the contour -1: outside the contour 0:lies on the edge;
*
* @param openCvWidth
* The width in the opencv screen
* @param openCvHeight
* The height in the opencv screen
*/
public int isPointInFloor(int openCvWidth, int openCvHeight) {
return isPointInFloor(openCvWidth, openCvHeight, false);
public class TestConSum {
public static void main(String... args) {
int[] arr = new int[]{-2,11,-4,13, -9, -10,99};
int negsum = 0;
int maxsum = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] < 0) {