public class Demo {
發(fā)展壯大離不開廣大客戶長期以來的信賴與支持,我們將始終秉承“誠信為本、服務(wù)至上”的服務(wù)理念,堅持“二合一”的優(yōu)良服務(wù)模式,真誠服務(wù)每家企業(yè),認真做好每個細節(jié),不斷完善自我,成就企業(yè),實現(xiàn)共贏。行業(yè)涉及成都酒店設(shè)計等,在網(wǎng)站建設(shè)公司、全網(wǎng)營銷推廣、WAP手機網(wǎng)站、VI設(shè)計、軟件開發(fā)等項目上具有豐富的設(shè)計經(jīng)驗。
public static void main(String[] args) {
Demo demo = new Demo();
demo.question1();
demo.question2();
demo.question3();
demo.question4();
demo.question5();
demo.question6();
}
private void question1() {
System.out.println("Q1:");
Scanner scanner = new Scanner(System.in);
System.out.println("請輸入第一個數(shù):");
int num1 = scanner.nextInt();
System.out.println("請輸入第二個數(shù):");
int num2 = scanner.nextInt();
System.out.println("和: " + (num1 + num2));
System.out.println("差: " + (num1 - num2));
System.out.println("積: " + (num1 * num2));
String value = String.valueOf((double) num1 / num2);
System.out.println("商: " + (value.substring(0, value.indexOf("."))));
System.out.println("余數(shù): " + (num1 % num2));
}
private void question2() {
System.out.println("Q2:");
Scanner scanner = new Scanner(System.in);
System.out.println("請輸入圓柱體地面半徑: ");
double r = scanner.nextDouble();
System.out.println("請輸入圓柱體高: ");
double h = scanner.nextDouble();
System.out.println("圓柱體體積: " + (Math.PI * Math.pow(r, 2) * h));
}
private void question3() {
System.out.println("Q3:");
Scanner scanner = new Scanner(System.in);
System.out.println("清輸入年份: ");
int year = scanner.nextInt();
System.out.println(year + (year % 4 == 0 year % 100 != 0 || year % 400 == 0 ? "是" : "不是") + "閏年");
}
private void question4() {
System.out.println("Q4:");
double gdb = 100;
int i = 0;
for (; gdb gdb * 2; i++) {
gdb += gdb * 0.08;
}
System.out.println("經(jīng)過" + i + "年,GDP可以翻一番");
}
private void question5() {
System.out.println("Q5:");
Scanner scanner = new Scanner(System.in);
System.out.println("請輸入10個數(shù),用空格隔開: ");
String input = scanner.nextLine();
String[] numbers = input.split("\\s");
int min = Integer.parseInt(numbers[0]);
int max = Integer.parseInt(numbers[0]);
for (int i = 1; i 10; i++) {
int number = Integer.parseInt(numbers[i]);
max = Math.max(number, max);
min = Math.min(number, min);
}
System.out.println("最大值: " + max + ", 最小值: " + min);
}
private void question6() {
System.out.println("Q6:");
Scanner scanner = new Scanner(System.in);
System.out.println("請輸入第一個數(shù): ");
int num1 = scanner.nextInt();
System.out.println("請輸入第二個數(shù): ");
int num2 = scanner.nextInt();
for (int i = Math.max(num1, num2); i 0; i--) {
if (num1 % i == 0 num2 % i == 0) {
System.out.println("最大公約數(shù): " + i);
break;
}
}
for (int i = Math.max(num1, num2); ; i++) {
if (i % num1 == 0 i % num2 == 0) {
System.out.println("最小公倍數(shù): " + i);
break;
}
}
}
}
是jdbc不是gdbc就是java database connection也就是java操作數(shù)據(jù)庫的一組api
需要用到一個pdf的jar包,去網(wǎng)上下載一個itextpdf.jar。導(dǎo)出pdf的格式都是需要自己用代碼實現(xiàn)的,每一行 ,每一個列是什么格式,都需要自己寫出來,是不能夠自動生成的,反正很麻煩。我做的一個導(dǎo)出成pdf特定格式的東西,寫了好幾千行代碼。相當頭痛。
package com.dw.mqs.export;
import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import java.net.URL;
import java.util.Date;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dw.file.WebHelper;
import com.dw.mqs.MqsManager;
import com.dw.mqs.MqsUtilNew;
import com.dw.mqs.ProductItem;
import com.dw.mqs.ProjectBasicItem;
import com.dw.mqs.ProjectConfDetailItem;
import com.dw.mqs.ProjectConfVerItem;
import com.dw.mqs.ProjectConfig;
import com.dw.mqs.ProjectService;
import com.dw.mqs.Util;
import com.dw.system.Convert;
import com.dw.system.gdb.DBResult;
import com.dw.system.gdb.DataRow;
import com.dw.system.gdb.GDB;
import com.dw.user.User;
import com.dw.user.UserManager;
import com.dw.user.UserProfile;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class PdfService
{
Document document = new Document(PageSize.A4.rotate(), 50, 50, 50, 50);
ByteArrayOutputStream os = new ByteArrayOutputStream();
PdfWriter pdf = PdfWriter.getInstance(document, os);
Rectangle rect = new Rectangle(36, 54, 559, 788);
pdf.setBoxSize("art", rect);
pdf.setPageEvent(new TableHeader());
document.open();
BaseFont baseArialuni = BaseFont.createFont("res/ARIALUNI.TTF",
BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); // Arial
// unicode字體
Font fontCN = new Font(baseArialuni, 9, Font.NORMAL, Color.BLACK);
Font fontCN8b = new Font(baseArialuni, 9, Font.BOLD, Color.BLACK);
Font fontCN12b = new Font(baseArialuni, 12, Font.BOLD, Color.BLACK);
Font fontCN9b = new Font(baseArialuni, 10, Font.BOLD, Color.BLACK);
Font fontCN9 = new Font(baseArialuni, 10, Font.NORMAL, Color.BLACK);
Font fontCN9b_blue = new Font(baseArialuni, 10, Font.BOLD, Color.BLUE);
PdfPTable table = null;
PdfPCell cell = null;
table = new PdfPTable(relativeWidths);
table.setWidthPercentage(100);
cell = new PdfPCell(new Paragraph(tit + "標題", fontCN12b));
cell.setColspan(root ? 12 : 10);
cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
cell.setBorder(Rectangle.NO_BORDER);
table.addCell(cell);
}
1)下載jdbshell并編譯
因為我基本上每次一開始都要執(zhí)行threads變量,所以我在開始wile循環(huán)前加了一句話
else
{
close(parent_to_child[0]);
write(parent_to_child[1], "threads\n",strlen("threads\n"));
while(1)
{
int i = 0;
line = readline ("");
...
}
}
編譯后將jdbshell放到~/bin,或者將目錄加到PATH里
出現(xiàn)無法打開readline.h的話,安裝libreadline6和libreadline6-dev
2)仿照gdbclient,在build/envsetup.sh中加入jdbclient函數(shù)
function jdbclient()
{
local MY_SRC_PATH="$1"
if [ "$MY_SRC_PATH" ] ; then
MY_SRC_PATH=$1
echo $MY_SRC_PATH
else
echo "ROOT" $OUR_ROOT
MY_SRC_PATH="app_process"
fi
local PORT="$2"
if [ "$PORT" ] ; then
PORT=$2
else
PORT=":9000"
fi
local PID
local PROG="$3"
if [ "$PROG" ] ; then
PID=`pid $3`
echo tcp$PORT jdwp$PID
adb forward "tcp$PORT" "jdwp:$PID"
echo jdbshell -sourcepath $MY_SRC_PATH -attach localhost$PORT
jdbshell -sourcepath $MY_SRC_PATH -attach localhost$PORT
sleep 2
else
echo ""
echo "please specify app you want to debug:"
echo ""
fi
}
3)啟動android模擬器,運行瀏覽器
4)jdbclient packets/app/Browser/src/ :9000 browser
第一個參數(shù)是你要load進來的代碼的地址,如果你要load多個代碼(調(diào)試的時候可以看),可以
export DEBUG_SRC_PATH=
然后
jdbclient $DEBUG_SRC_PATH :9000 browser
第二個參數(shù)是attach端口,如果9000有在用,可以用其他端口
第三個參數(shù)是要調(diào)試的應(yīng)用,腳本里面根據(jù)
pid browser來取得進程id,所以你要保證
adb shell ps |grep browser
能夠看到對應(yīng)的進程
有一種辦法是, 我們用gdb的step, 一步一步尋找.
這放在短小的代碼中是可行的, 但要讓你step一個上萬行的代碼, 我想你會從此厭惡程序員這個名字, 而把他叫做調(diào)試員.
標題名稱:java代碼gdb,java代碼例子
轉(zhuǎn)載注明:http://jinyejixie.com/article44/hsdche.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、建站公司、外貿(mào)網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站、響應(yīng)式網(wǎng)站、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)