欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

java代碼行數(shù)統(tǒng)計(jì),java代碼行數(shù)統(tǒng)計(jì)工具

如何計(jì)算一個(gè).java文件的代碼行數(shù)

方法一:

創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括平塘網(wǎng)站建設(shè)、平塘網(wǎng)站制作、平塘網(wǎng)頁(yè)制作以及平塘網(wǎng)絡(luò)營(yíng)銷策劃等。多年來(lái),我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,平塘網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到平塘省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

如果想要通過(guò)java代碼的方式來(lái)計(jì)算.java文件的行數(shù),可以通過(guò)IO來(lái)讀取,

BufferedReader的方法readLine()來(lái)按行讀取,每讀取一行,行數(shù)+1

方法二:

如果要查看.java文件的代碼行數(shù),

可以使用現(xiàn)成的IDE工具,比如ECLIPSE...

每一行的行號(hào)都有表示出來(lái)

eclipse怎么統(tǒng)計(jì)代碼行數(shù)

步驟如下:

1、打開(kāi)File Search對(duì)話框。

2、選中正則表達(dá)式,在搜索文本框輸入\n 。

3、文件名稱輸入 *.java。

4、在范圍里選中Enclosing projects。

經(jīng)過(guò)上面方式,就可以統(tǒng)計(jì)出整個(gè)項(xiàng)目的代碼行數(shù)。

Java 有什么好的代碼行數(shù),注釋行數(shù)統(tǒng)計(jì)工具

package com.syl.demo.test;

import java.io.*;

/**

* java代碼行數(shù)統(tǒng)計(jì)工具類

* Created by 孫義朗 on 2017/11/17 0017.

*/

public class CountCodeLineUtil {

private static int normalLines = 0; //有效程序行數(shù)

private static int whiteLines = 0; //空白行數(shù)

private static int commentLines = 0; //注釋行數(shù)

public static void countCodeLine(File file) {

System.out.println("代碼行數(shù)統(tǒng)計(jì):" + file.getAbsolutePath());

if (file.exists()) {

try {

scanFile(file);

} catch (IOException e) {

e.printStackTrace();

}

} else {

System.out.println("文件不存在!");

System.exit(0);

}

System.out.println(file.getAbsolutePath() + " ,java文件統(tǒng)計(jì):" +

"總有效代碼行數(shù): " + normalLines +

" ,總空白行數(shù):" + whiteLines +

" ,總注釋行數(shù):" + commentLines +

" ,總行數(shù):" + (normalLines + whiteLines + commentLines));

}

private static void scanFile(File file) throws IOException {

if (file.isDirectory()) {

File[] files = file.listFiles();

for (int i = 0; i files.length; i++) {

scanFile(files[i]);

}

}

if (file.isFile()) {

if (file.getName().endsWith(".java")) {

count(file);

}

}

}

private static void count(File file) {

BufferedReader br = null;

// 判斷此行是否為注釋行

boolean comment = false;

int temp_whiteLines = 0;

int temp_commentLines = 0;

int temp_normalLines = 0;

try {

br = new BufferedReader(new FileReader(file));

String line = "";

while ((line = br.readLine()) != null) {

line = line.trim();

if (line.matches("^[//s[^//n]]*$")) {

// 空行

whiteLines++;

temp_whiteLines++;

} else if (line.startsWith("/*") !line.endsWith("*/")) {

// 判斷此行為"/*"開(kāi)頭的注釋行

commentLines++;

comment = true;

} else if (comment == true !line.endsWith("*/")) {

// 為多行注釋中的一行(不是開(kāi)頭和結(jié)尾)

commentLines++;

temp_commentLines++;

} else if (comment == true line.endsWith("*/")) {

// 為多行注釋的結(jié)束行

commentLines++;

temp_commentLines++;

comment = false;

} else if (line.startsWith("http://")) {

// 單行注釋行

commentLines++;

temp_commentLines++;

} else {

// 正常代碼行

normalLines++;

temp_normalLines++;

}

}

System.out.println(file.getName() +

" ,有效行數(shù)" + temp_normalLines +

" ,空白行數(shù)" + temp_whiteLines +

" ,注釋行數(shù)" + temp_commentLines +

" ,總行數(shù)" + (temp_normalLines + temp_whiteLines + temp_commentLines));

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} finally {

if (br != null) {

try {

br.close();

br = null;

} catch (IOException e) {

e.printStackTrace();

}

}

}

}

//測(cè)試

public static void main(String[] args) {

File file = new File("F:\\myweb");

countCodeLine(file);

}

}

anaconda如何計(jì)算全部代碼行數(shù)

計(jì)算全部代碼行數(shù)方法。

方法一:在需要統(tǒng)計(jì)的目錄下執(zhí)行(直接復(fù)制可能會(huì)有字符編碼問(wèn)題,建議手?jǐn)],如需統(tǒng)計(jì)其他形式文件行數(shù),只需修改.java為相應(yīng)文件后綴即可)

find.-name*.java-execwc-l{};|awk‘{s+=$1}END{prints}’

方法二:l/傳入文件路徑返回文件下所有文件內(nèi)容行數(shù)unsignedlongcodeLineCount(NSString*Path)

//獲得文件管理者

NSFileManager*mgr=[NSFileManagerdefaultManager];

//判path是文件夾還是文件路徑

BoOLdir=No;//標(biāo)記是否為文件夾

l/這個(gè)路徑是否存在

BoOLexists=[mgrfileExistsAtPath:PathisDirectory:dir];

//如果不存在,直接返回e

if(!exists)returne;

if(dir){

NSLog(@"是個(gè)文件夾");

怎么用java編寫統(tǒng)計(jì)文件中的字符數(shù)、單詞數(shù)和行數(shù)?

在C盤新建文件1.txt,輸入任意字符,如下圖:

編寫java代碼。如下:

import?java.io.BufferedReader;

import?java.io.FileNotFoundException;

import?java.io.FileReader;

import?java.io.IOException;

import?java.util.TreeMap;

public?class?Test?{

//?統(tǒng)計(jì)數(shù)字或者字符出現(xiàn)的次數(shù)

public?static?TreeMapCharacter,?Integer?Pross(String?str)?{

char[]?charArray?=?str.toCharArray();

TreeMapCharacter,?Integer?tm?=?new?TreeMapCharacter,?Integer();

for?(int?x?=?0;?x??charArray.length;?x++)?{

if?(!tm.containsKey(charArray[x]))?{

tm.put(charArray[x],?1);

}?else?{

int?count?=?tm.get(charArray[x])?+?1;

tm.put(charArray[x],?count);

}

}

return?tm;

}

public?static?void?main(String[]?args)?{

BufferedReader?br?=?null;

int?line?=?0;

String?str?=?"";

StringBuffer?sb??=?new?StringBuffer();

try?{

br?=?new?BufferedReader(new?FileReader("c:\\1.txt"));

while?((str?=?br.readLine())?!=?null)?{

sb.append(str);

++line;

}

System.out.println("\n文件行數(shù):?"?+?line);

System.out.println("\n文件內(nèi)容:?"?+?sb.toString());

TreeMapCharacter,?Integer?tm?=?Pross(sb.toString());

System.out.println("\n字符統(tǒng)計(jì)結(jié)果為:"?+?tm);

}?catch?(FileNotFoundException?e)?{

e.printStackTrace();

}?catch?(IOException?e)?{

e.printStackTrace();

}?finally?{

if?(br?!=?null)?{

try?{

br.close();

}?catch?(IOException?e)?{

//?TODO?Auto-generated?catch?block

e.printStackTrace();

}

}

}

}

}運(yùn)行結(jié)果如下圖:

網(wǎng)站題目:java代碼行數(shù)統(tǒng)計(jì),java代碼行數(shù)統(tǒng)計(jì)工具
URL地址:http://aaarwkj.com/article38/dsshcsp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、、企業(yè)建站全網(wǎng)營(yíng)銷推廣外貿(mào)建站、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

營(yíng)銷型網(wǎng)站建設(shè)
中文字幕国产精品一二区| 亚洲精品一区二区三区中文字幕| 国产熟女碰碰人人a久久| 亚洲午夜精品久久久天堂| 久久精品国产免费夜夜嗨| 国产男女做爰在线视频| 久久婷婷av一区二区三区| 成年人三级黄色片视频| 欧美一区二区三区高清在线| av国产一区二区在线| 亚洲天堂成人综合在线| 97精品在线视频免费| 国产自拍成人精品视频| 久久综合久中文字幕青草| 国产夫妻自拍一级黄片| 国产在线一区二区三区观看 | 日本人的黄色录像视频| 日韩精品视频高清在线观看| 欧美黄片不用下载在线观看| 国产 亚洲 一区 二区| 亚洲乱码中文字幕人妻| 青青草国产自拍在线视频| 精品亚洲av一区二区三区| 国产龙熟女高潮一区二区| 麻豆精品人妻中文在线| 青青草青青草在线观看视频| 熟女肥臀一区二区三区| 亚洲熟妇av一区二区| 视频免费观看网站不卡| 欧美日韩一区二区高清在线| 太爽了少妇高潮在线看片| 国产精品久久99精品| 国产精品一区二区夜夜夜| 色播五月麻豆激情综合网| 久久久国产精品视频网站| 国产成人在线免费短视频| 韩国av一区二区三区| 蜜桃臀内射一区二区三区| 国产精品黑丝美女91| 激情少妇一区二区三区| 男女做爰高清免费视频|