This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"os" | |
"os/exec" | |
"strconv" | |
"strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jsi.http; | |
import java.io.ByteArrayOutputStream; | |
import java.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import javax.microedition.io.Connector; | |
import javax.microedition.io.HttpConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap bmBg = Bitmap.getBitmapResource("background.png"); | |
Background bg = BackgroundFactory.createBitmapBackground(bmBg, Background.POSITION_X_LEFT, Background.POSITION_Y_TOP, Background.REPEAT_SCALE_TO_FIT); | |
VerticalFieldManager myVfm = new VerticalFieldManager(USE_ALL_WIDTH | USE_ALL_HEIGHT | VERTICAL_SCROLL); | |
myVfm.setBackground(bg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Formatter myFormatter = new Formatter(); | |
double piOld = 3.14159265; | |
int decimals = 4; | |
double piFormatted = Double.parseDouble(myFormatter.formatNumber(piOld, decimals)); | |
System.out.println(piOld + " " + piFormatted); | |
// Output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mypackage; | |
import net.rim.device.api.ui.Field; | |
import net.rim.device.api.ui.FieldChangeListener; | |
import net.rim.device.api.ui.UiApplication; | |
import net.rim.device.api.ui.component.ButtonField; | |
import net.rim.device.api.ui.component.LabelField; | |
import net.rim.device.api.ui.container.MainScreen; | |
public class MyApp extends UiApplication { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class BinarySearchTreeDemo { | |
public static void main(String args[]) { | |
Random r = new Random(); | |
int numOfElements = 5; | |
// Construct tree | |
BinarySearchTree tree = new BinarySearchTree(); | |
for (int i = 0; i < numOfElements; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NumberConversionDemo { | |
public static void main(String[] args) { | |
BaseConverter baseConverter = new BaseConverter(); | |
int targetBase = BaseConverter.HEXADECIMAL; | |
String convertedNumber; | |
for (int i = -100; i < 100; i++) { | |
convertedNumber = baseConverter.convert(i, targetBase); | |
System.out.println(i + "(10) = " + convertedNumber + "(targetBase)"); | |
} | |
} |